WebView height = wrap_content with changing font size doesn't work

后端 未结 7 1595
醉话见心
醉话见心 2020-12-19 06:54

I have webview with layout_height = \"wrap_content\". If I increase default font size, then webview height increases too. But if I decrease default font size, then webview h

相关标签:
7条回答
  • 2020-12-19 07:25

    Try the following combination:

    <LinearLayout
         android:id="@+id/xxxxxxxxxxxxxxxxxxx"
         android:layout_width="match_parent"
         android:layout_height="200dp"
         android:orientation="vertical" >
    
         <TextView
             android:id="@+id/yyyyyyyyyyyyyyyyyyyyy"
             style="@style/Etiquetas"
             android:text="@string/hola" />
    
         <WebView android:paddingLeft="10dp" 
             android:id="@+id/zzzzzzzzzzzzzzz"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
             android:background="@null" >
         </WebView>
    
    </LinearLayout>
    

    Java:

    LinearLayout. LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT);
    xxxxxxxxxxxxxxxxxxx.setLayoutParams(params);
    WebView  zzzzzzzzzzzzzzz = (WebView) findViewById(R.id.zzzzzzzzzzzzzzz); 
    zzzzzzzzzzzzzzz.setBackgroundColor(0x00000000);
    zzzzzzzzzzzzzzz.loadData(Html.fromHtml(mistringsqlite).toString(), "text/html", null);
    
    0 讨论(0)
提交回复
热议问题