- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical" >
- <include
- android:id="@+id/***"
- layout="@layout/***" />
- <ScrollView
- android:layout_width="match_parent"
- android:layout_height="match_parent">
- <ImageView
- android:id="@+id/iv_guide_detail"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_horizontal" />
- </ScrollView>
- </LinearLayout>
-
这样在手机上面会出现ImageView上下都有一块空白,解决问题的做法就是在ImageView 中添加下面的一段代码:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:fillViewport="true">
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<ImageView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:src="@drawable/huge"
android:scaleType="fitCenter" android:layout_weight="1" />
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content">
<!-- Insert your content here -->
</LinearLayout>
</LinearLayout>
</ScrollView>
android:fillViewport="true" 必须设置的啊