【发布时间】:2017-10-07 06:18:54
【问题描述】:
如何删除屏幕底部的这个空白区域。我也试过android:adjustviewbounds 和android:scaletype。但仍然未能删除屏幕底部的空白。请帮我优化我的布局,以便我可以从底部删除那个丑陋的空白。
这是我的布局屏幕下面的屏幕截图。
这是我的布局的 XML 代码。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_height="wrap_content"
android:layout_width="match_parent"
tools:context="com.example.zohai.v360.Fragments.Home">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="190dp"
android:layout_marginTop="-15dp">
<ImageView
android:id="@+id/intro"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:adjustViewBounds="true"
android:background="@drawable/intro"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="190dp"
android:layout_marginTop="-15dp"
>
<ImageView
android:id="@+id/photog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/photographers"
android:adjustViewBounds="true"
android:scaleType="fitXY"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="190dp"
android:layout_marginTop="-14dp">
<ImageView
android:id="@+id/model"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/model_bg"
android:adjustViewBounds="true"
android:scaleType="fitXY"
/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
【问题讨论】:
-
这是空白部分,因为在 3x190 之后仍有一些屏幕高度,您为什么使用负边距...?
-
从你的问题我可以理解的是,你有这三张图片,你希望它占据你的整个屏幕,不留空白。这是你想要的吗?
-
是的,这正是我想要的
-
我使用负边距去除图像之间的空白
-
只需使用工具栏中使用的背景图片即可。顺便说一句……你为什么要使用所有那些毫无意义的线性布局?!尽快将它们全部删除!嵌套布局不利于性能。
标签: android android-layout scrollview