我在将 android.support.percent.PercentRelativeLayout 与 ScrollView 结合时遇到问题。以下xml文件
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true"
android:scrollbars="none">
<android.support.percent.PercentRelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:background="@color/white"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
>
<ImageView
android:layout_height="match_parent"
android:layout_width="match_parent"
app:layout_widthPercent="50%"
app:layout_heightPercent="50%"
app:layout_marginTopPercent="5%"
app:layout_marginLeftPercent="5%"
android:src="@drawable/o"
android:id="@+id/imageView3" />
<ImageView
android:layout_height="match_parent"
android:layout_width="match_parent"
app:layout_widthPercent="50%"
app:layout_heightPercent="50%"
app:layout_marginTopPercent="30%"
app:layout_marginLeftPercent="5%"
android:src="@drawable/o"
android:layout_below="@+id/imageView3"
android:layout_alignStart="@+id/imageView3"
android:layout_marginTop="151dp" />
</android.support.percent.PercentRelativeLayout>
使用 RelativeLayout 它可以正常工作。有谁知道问题出在哪里?谢谢!
编辑:如果我将 ScrollView 高度设置为 1000dp 它也可以正常工作,但我希望高度与元素一样马赫