0
我正在開發一個android項目,我添加了一個滾動活動。屏幕下端有一部分採用了背景顏色,使得一切看起來不整潔。 This is how it looks。我該如何解決?我想中間部分延伸到屏幕的底部,我嘗試了一切變化的高度,匹配到父母。沒有任何工作。您的幫助非常感謝!謝謝。代碼如下。我的滾動活動的佈局問題
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".ScrollingActivity"
tools:showIn="@layout/activity_scrolling"
android:background="@drawable/backgnd"
android:layout_marginRight="24dp"
android:layout_marginLeft="24dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:layout_weight="1"
android:text="This is a generic message" />
<Button
android:layout_width="48dp"
android:id="@+id/button"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:background="@drawable/play" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:layout_weight="1"
android:text="This is a generic message" />
<Button
android:layout_width="48dp"
android:id="@+id/button1"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:background="@drawable/play" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:layout_weight="1"
android:text="This is a generic message" />
<Button
android:layout_width="48dp"
android:id="@+id/button2"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:background="@drawable/play" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:layout_weight="1"
android:text="This is a generic message" />
<Button
android:layout_width="48dp"
android:id="@+id/button3"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:background="@drawable/play" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:layout_weight="1"
android:text="This is a generic message" />
<Button
android:layout_width="48dp"
android:id="@+id/button4"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:background="@drawable/play" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:layout_weight="1"
android:text="This is a generic message" />
<Button
android:layout_width="48dp"
android:id="@+id/button5"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:background="@drawable/play" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:layout_weight="1"
android:text="This is a generic message" />
<Button
android:layout_width="48dp"
android:id="@+id/button6"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:background="@drawable/play" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:layout_weight="1"
android:text="This is a generic message" />
<Button
android:layout_width="48dp"
android:id="@+id/button7"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:background="@drawable/play" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:layout_weight="1"
android:text="This is a generic message" />
<Button
android:layout_width="48dp"
android:id="@+id/button8"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:background="@drawable/play" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:layout_weight="1"
android:text="This is a generic message" />
<Button
android:layout_width="48dp"
android:id="@+id/button9"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:background="@drawable/play" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:layout_weight="1"
android:text="This is a generic message" />
<Button
android:layout_width="48dp"
android:id="@+id/button10"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:background="@drawable/play" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:layout_weight="1"
android:text="This is a generic message" />
<Button
android:layout_width="48dp"
android:id="@+id/button11"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:background="@drawable/play" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:layout_weight="1"
android:text="This is a generic message" />
<Button
android:layout_width="48dp"
android:id="@+id/button12"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:background="@drawable/play" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:layout_weight="1"
android:text="This is a generic message" />
<Button
android:layout_width="48dp"
android:id="@+id/button13"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:background="@drawable/play" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:layout_weight="1"
android:text="This is a generic message" />
<Button
android:layout_width="48dp"
android:id="@+id/button14"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:background="@drawable/play" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:layout_weight="1"
android:text="This is a generic message" />
<Button
android:layout_width="48dp"
android:id="@+id/button15"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:background="@drawable/play" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:layout_weight="1"
android:text="This is a generic message" />
<Button
android:layout_width="48dp"
android:id="@+id/button16"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:background="@drawable/play" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:layout_weight="1"
android:text="This is a generic message" />
<Button
android:layout_width="48dp"
android:id="@+id/button17"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:background="@drawable/play" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:layout_weight="1"
android:text="This is a generic message" />
<Button
android:layout_width="48dp"
android:id="@+id/button18"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:background="@drawable/play" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:layout_weight="1"
android:text="This is a generic message" />
<Button
android:layout_width="48dp"
android:id="@+id/button19"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:background="@drawable/play" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:layout_weight="1"
android:text="This is a generic message" />
<Button
android:layout_width="48dp"
android:id="@+id/button20"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:background="@drawable/play" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:layout_weight="1"
android:text="This is a generic message" />
<Button
android:layout_width="48dp"
android:id="@+id/button21"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:background="@drawable/play" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:baselineAligned="false">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/text_margin"
android:layout_weight="1"
android:text="This is a generic message"
android:layout_gravity="center_horizontal" />
<Button
android:layout_width="48dp"
android:id="@+id/button22"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:background="@drawable/play" />
</LinearLayout>
</LinearLayout>
首先分享此佈局的xml。 – Vucko
也發佈你的佈局,並清楚地說出你想要的佈局。 –
@vucko我已經添加了XML。 –