2014-01-25 2 views
0

Как это исправить? Я использую Webview и устанавливаю backgroundResource. Как можно централизовать текст внутри webView?Центр Текст выравнивания в WebView?

Это мой XML-код

<WebView 
     android:id="@+id/webView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:paddingBottom="10sp" 
     android:gravity="center" 
     android:layout_centerHorizontal="true" 
     android:layout_marginTop="81dp" /> 

enter image description here

+0

: попробуйте использовать 'gravity' –

+0

Я уже делаю это андроид: гравитация = «центр», но ничего не происходит :( – chicharp

+0

Откуда у вас этот текст? –

ответ

0
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" > 

    <FrameLayout 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1" > 

     <WebView 
      android:id="@+id/webview" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:visibility="gone" /> 

     <TextView 
      android:id="@+id/textView" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:gravity="center" 
      android:text="This is Textview.This is Textview.This is Textview.This is Textview.This is Textview.This is Textview.This is Textview.This is Textview.This is Textview." /> 
    </FrameLayout> 

</LinearLayout> 

использование этого и установить видимость через деятельность

Смежные вопросы