【发布时间】:2016-11-26 17:15:23
【问题描述】:
Android 视图似乎很挑剔。看起来滚动视图的高度需要为:
height ="wrap_content"
为了正常运行,但这搞砸了,因为我之前使用权重总和的想法是当它是 match_parent 时它占据了整个屏幕。无论如何,滚动视图内的列表视图内的项目仍然有百分比吗?或者一个替代方案,如果可能的话,一个例子。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#DDDDDD"
android:descendantFocusability="beforeDescendants"
android:focusable="false"
android:focusableInTouchMode="true"
android:weightSum="100">
<ScrollView
android:layout_width="match_parent"
android:fillViewport="true"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="100">
<ImageButton
android:src="@android:drawable/ic_menu_gallery"
android:layout_width="match_parent"
android:layout_height="0dp"
android:id="@+id/image"
android:scaleType="fitXY"
android:layout_weight="30" /> ...
这里只是一个样本,因为它很长。那个图片按钮我想占据屏幕的 30% 左右。
【问题讨论】:
标签: xml xamarin xamarin.android