【发布时间】:2017-05-06 17:49:33
【问题描述】:
我的应用程序中有一个 WebView。我想将其中的文本从右到左对齐。我尝试添加:
<WebView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:layout_margin="@dimen/spacing_xsmall" />
这是我的代码
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:orientation="vertical"
android:padding="@dimen/spacing_middle"
android:visibility="visible">
<TextView
android:id="@+id/category"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:background="@color/colorAccentLight"
android:paddingBottom="@dimen/spacing_xsmall"
android:paddingLeft="@dimen/spacing_medium"
android:paddingRight="@dimen/spacing_medium"
android:paddingTop="@dimen/spacing_xsmall"
android:text="Category"
android:textAllCaps="true"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textColor="@android:color/white" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/grey_soft"
android:paddingBottom="@dimen/spacing_large"
android:paddingTop="@dimen/spacing_middle">
<WebView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/spacing_xsmall" />
</RelativeLayout>
但这对我不起作用。 textview 工作正常,但 WebView 不工作? 我该如何解决这些问题
谢谢。
【问题讨论】:
-
它不能解决我的问题,但可以帮助使用正确的理由重新创建它mobikul.com/align-justify-text-android
-
在制作日志后一直在加载动态数据我意识到问题正在逃逸...stackoverflow.com/a/18898904/1815624 用于测试
str.replace("\\\"", "\"")给了我右对齐的结果...