2017-05-06 2 views
0

aus Ich habe ein WebView in meiner Anwendung. Ich möchte den Text darin von rechts nach links ausrichten. Ich habe versucht, und fügte hinzu:Richten Sie Text in android aus 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" /> 

dies mein Code

<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> 

ist aber das für mich nicht funktioniert. die Textansicht funktioniert gut, aber das WebView funktioniert nicht ?? Wie kann ich die Probleme lösen

danke.

Antwort

0

Die Webansicht in Android wird zum Anzeigen von Webseiten verwendet. Es zeigt die Daten auf der Webseite so an, wie sie sind.

Wenn Sie die Textausrichtung der Webseite ändern möchten, müssen Sie dies von der Website aus tun (vorausgesetzt, Sie haben Zugriff darauf).

Verwandte Themen