我正在处理Android中的一个表单,该表单用于为我的应用创建一个功能。但目前我正在使用带有嵌套scrollview的CoordinatorLayout。但它在我的滚动底部给出了一个空白区域。如何删除?
这是我的xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/ash"
android:orientation="vertical">
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/ash"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/ctl"
android:layout_width="match_parent"
android:layout_height="350dp"
android:background="@color/ash"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleTextAppearance="@android:color/transparent"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/layout_layer"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:id="@+id/img_chatroom"
android:layout_width="match_parent"
android:layout_height="150dp"
android:contentDescription="@string/app_name"
android:scaleType="centerCrop"
android:src="@drawable/profile_img_bg"
app:layout_collapseMode="parallax" />
<TextView
android:id="@+id/tv_chatroomname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/img_chatroom"
android:gravity="center_horizontal"
android:padding="5dp"
android:text="Chatroom Name"
android:textColor="@color/black"
android:textSize="@dimen/large_text" />
<TextView
android:id="@+id/tv_chatroomdescription"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/tv_chatroomname"
android:layout_margin="10dp"
android:padding="5dp"
android:text="Chatroom DescriptionChatroom DescriptionChatroomChatroom DescriptionChatroom DescriptionChatroomChatroom DescriptionChatroom DescriptionChatroomChatroom DescriptionChatroom DescriptionChatroom"
android:textColor="@color/black"
android:textSize="@dimen/small_text" />
</RelativeLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:title="Settings"
app:layout_collapseMode="pin" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/layout_layer"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/rl_create_menu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/rl_picture"
android:layout_margin="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:text="Chatroom Type"
android:textColor="@color/black" />
<RadioGroup
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Public"
android:theme="@style/MyRadioButton" />
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Private"
android:theme="@style/MyRadioButton" />
</RadioGroup>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/rl_country_res"
android:layout_width="wrap_content"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="Country Wise Restriction"
android:textColor="@color/black"
android:textSize="@dimen/small_medium_text" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_gravity="bottom"
android:layout_marginTop="10dp"
android:background="@color/deep_ash" />
<RelativeLayout
android:id="@+id/rl_chatroom_capacity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Chatroom Capacity"
android:textColor="@color/black"
android:textSize="@dimen/small_medium" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/ash" />
<RelativeLayout
android:id="@+id/rl_country"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Country"
android:textColor="@color/black"
android:textSize="@dimen/small_medium" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_gravity="bottom"
android:background="@color/ash" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:padding="5dp">
<TextView
android:id="@+id/tv_protect_chatroom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Protect Chatroom"
android:textColor="@color/black"
android:textSize="@dimen/small_medium" />
<ToggleButton
android:layout_width="40dp"
android:layout_height="18dp"
android:layout_alignParentRight="true"
android:background="@drawable/toggle_silector"
android:checked="false"
android:text=""
android:textOff=""
android:textOn="" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_protect_chatroom"
android:layout_marginTop="10dp"
android:text="Without code no one can join with you" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:padding="5dp">
<TextView
android:id="@+id/tv_auto_flood_control"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Auto Flood Control"
android:textColor="@color/black"
android:textSize="@dimen/small_medium" />
<ToggleButton
android:layout_width="40dp"
android:layout_height="18dp"
android:layout_alignParentRight="true"
android:background="@drawable/toggle_silector"
android:checked="false"
android:text=""
android:textOff=""
android:textOn="" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_auto_flood_control"
android:layout_marginTop="10dp"
android:text="If you enable flood control , User will be kicked automatically from chatroom" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_idle_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Maximum Idle Time"
android:textColor="@color/black"
android:textSize="@dimen/small_medium" />
</RelativeLayout>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="35dp"
android:background="@drawable/shape_for_submit_button"
android:gravity="center"
android:padding="4dp"
android:text="Create Chatroom"
android:textColor="@color/black"
android:textSize="@dimen/small_medium" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
我已尝试在堆栈溢出但发现无法正常工作的几件事情。我如何解决这个问题?
答案 0 :(得分:2)
将高度更改为match_parent
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FF0000"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
我添加了background
,您可以看到它的color
。