我正在尝试在上半部分(屏幕的2/3)和列表视图(最后1/3)制作一个带有webview的Android UI。
我的网页视图在html代码中设置了固定的高度,只有我的列表视图可以在纵向模式下滚动。
但在横向模式下一切都出错:我的列表视图完全消失,而我的webview可以滚动
这是我的布局:
`
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<WebView
android:id="@+id/chartView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:id="@+id/alert_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:paddingBottom="15dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="No value since : "
android:textColor="@color/dark_gray" />
<Chronometer
android:id="@+id/chronometer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:format="%s"
android:textColor="@color/dark_gray"
android:textSize="15sp" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#017CBF"
android:paddingBottom="2dp"
android:paddingLeft="10dp"
android:paddingTop="2dp"
android:text="ALERT"
android:textColor="@android:color/white"
android:textStyle="bold" />
<ListView
android:id="@+id/alarmList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#d6d7d4" />
<TextView
android:id="@+id/empty_alert"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:text="No alert"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:textColor="@color/dark_gray" />
</LinearLayout>
</LinearLayout>
`
我尝试禁用webview滚动,但它在横向模式下也没有显示列表视图。 我也尝试将我的列表视图放在我的webview上,我很明显可以查看我的列表视图。但是我的网页浏览量会缩短,具体取决于列表视图内容,我无法滚动完整的布局。
我现在有点陷入困境,所以如果你有想法......
谢谢