Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/204.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ANDROID:Webview不全宽_Android_Html_Webview_Width - Fatal编程技术网

ANDROID:Webview不全宽

ANDROID:Webview不全宽,android,html,webview,width,Android,Html,Webview,Width,正如您在下面看到的,我有一个带有Webview和Imageview的布局。webview的权重必须为宽度的80%,而Imageview的权重应为宽度的0.2%。这应该可以很好地工作,但是webview不占用整个宽度,它只占用一半的宽度。在三星标签上甚至更少 我通过stackoverflow和internet搜索了各种解决方案。大多数人设置您必须设置LoadWithOverview模式,该模式可加载完全缩放的webview。这必须与setUseWideViewPort相结合,这迫使它采用webvi

正如您在下面看到的,我有一个带有Webview和Imageview的布局。webview的权重必须为宽度的80%,而Imageview的权重应为宽度的0.2%。这应该可以很好地工作,但是webview不占用整个宽度,它只占用一半的宽度。在三星标签上甚至更少

我通过stackoverflow和internet搜索了各种解决方案。大多数人设置您必须设置LoadWithOverview模式,该模式可加载完全缩放的webview。这必须与setUseWideViewPort相结合,这迫使它采用webview的尺寸

我已经玩了一天了,如果有人能提供一些帮助,我将不胜感激:

这是HTML:

<html> 
 <meta name="viewport" content="width=device-width", initial-scale=40></meta>
    <body style='background-color: transparent; color: Grey; font-family: HelveticaNeue-Light; font-size: 10pt; width: 258px; word-wrap: break-word;'>
     <div align='left'>When changing... 
       <span style='background-color: transparent; color: #a8c916; font-family: HelveticaNeue-Light; font-size: 10pt; word-wrap: break-word;'>%d punten</span> 
       <span style='background-color: transparent; color: Grey; font-family: HelveticaNeue-Light; font-size: 10pt; word-wrap: break-word;'>%@</span>
     </div>
</body>
XML:

<LinearLayout
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:weightSum="1">

    <WebView
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:id="@+id/textTagline"
            android:layout_weight="0.8"/>
    <ImageView
        android:id="@+id/arrow"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingTop="17dp"
        android:paddingRight="10dp"
        android:layout_weight="0.2"/>
</LinearLayout>

为此,您需要对xml进行以下更改:

<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">

<WebView
        android:layout_width="0dp"
        android:layout_height="fill_parent"
        android:id="@+id/textTagline"
        android:layout_weight="8"/>
<ImageView
    android:id="@+id/arrow"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:paddingTop="17dp"
    android:paddingRight="10dp"
    android:layout_weight="2"/>
</LinearLayout>
宽度应为0dp,以便布局重量正常工作

<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">

<WebView
        android:layout_width="0dp"
        android:layout_height="fill_parent"
        android:id="@+id/textTagline"
        android:layout_weight="8"/>
<ImageView
    android:id="@+id/arrow"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:paddingTop="17dp"
    android:paddingRight="10dp"
    android:layout_weight="2"/>
</LinearLayout>