2011-11-07 58 views
1

我在webView中显示一个html代码。任何人都可以告诉我如何将HTMl中的文本左右对齐吗?如何在Android Webview中对齐文本?

<?xml version="1.0" encoding="utf-8"?> 
<AbsoluteLayout 
android:id="@+id/al1" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:background="#ffffff" 
xmlns:android="http://schemas.android.com/apk/res/android"> 
<TextView 
android:id="@+id/tv1" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:text="About Us : Work Under Progress.." 
android:textSize="20sp" 
android:textStyle="bold" 
android:background="#ffffff" 
android:textColor="#ff000000" 
android:gravity="right" 
android:layout_x="0px" 
android:layout_y="0px"> 
</TextView> 
</AbsoluteLayout> 
+0

您是否尝试过重力左右? – NotACleverMan

+3

你是什么意思与左和右?左右同时? – Janusz

+0

对不起,我的意思是左或右。不是在同一时间。我甚至不确定那会做什么。 android:gravity =“left”应该左对齐 – NotACleverMan

回答

1

请尝试以下代码

<TextView> 

... 安卓重力= “右” ...

</TextView> 
+2

只需稍加说明,android:gravity =“right”应位于标记内。 – NotACleverMan

+0

是的,这就是为什么我也添加了标签。 – Lucifer

+0

@ Kalpen:它没有工作。 – Soniya