我想使用ScrollView和Toolbar作为LinearLayout的唯一子元素,但它们彼此重叠。搜索了一下,但没有找到有用的信息,有什么解决方法吗?除了给ScrollView设置padding/margin之外。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:float="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="right"
android:background="@color/white_dark_50">
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/toolbar"
android:theme="@style/AppTheme"
android:scrollbarStyle="outsideOverlay"
android:gravity="center_vertical|right"
android:layout_alignParentTop="true"
android:background="@color/colorPrimary"
>
<!-- -->
</android.support.v7.widget.Toolbar>
<ScrollView
android:scrollbarStyle="outsideOverlay"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_gravity="center"
android:background="@color/white_dark_50" >
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="right"
android:background="@color/white_dark_50">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ایجاد جمله جدید"
android:id="@+id/new_sentence_title"
android:textColor="@color/midnight_blue"
android:layout_margin="10dp"
android:textStyle="bold"
android:gravity="center_vertical"
android:drawableRight="@drawable/ic_colored_doll"
android:textAppearance="?android:attr/textAppearanceLarge"
/>
<View
android:layout_width="match_parent"
android:layout_height="3dp"
android:layout_marginLeft="25dp"
android:layerType="software"
android:layout_marginRight="25dp"
android:background="@drawable/dashed_line" />
<com.wrapp.floatlabelededittext.FloatLabeledEditTextRightSided
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_marginLeft="5dp"
android:layout_marginBottom="5dp"
float:fletPaddingLeft="10dp"
float:fletPaddingRight="10dp"
android:id="@+id/new_sentence_name"
float:fletPadding="10dp">
<EditText
android:layout_marginLeft="10dp"
android:id="@+id/new_sentence_name_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme"
android:backgroundTint="@color/accentColor"
android:singleLine="true"
android:textColor="@color/midnight_blue"
android:textColorHint="@color/hintColor"
android:maxLength="20"
android:drawableRight="@drawable/ic_name"
android:gravity="center_vertical|right"
android:hint="عنوان"/>
</com.wrapp.floatlabelededittext.FloatLabeledEditTextRightSided>
<com.wrapp.floatlabelededittext.FloatLabeledEditTextRightSided
android:layout_width="match_parent"
android:foregroundGravity="center_vertical|right"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_marginLeft="5dp"
android:layout_marginBottom="5dp"
float:fletPaddingLeft="10dp"
float:fletPaddingRight="10dp"
android:id="@+id/new_sentence_period"
float:fletPadding="10dp">
<EditText
android:id="@+id/new_sentence_period_et"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme"
android:backgroundTint="@color/accentColor"
android:singleLine="true"
android:layout_marginLeft="10dp"
android:inputType="number"
android:textColor="@color/midnight_blue"
android:textColorHint="@color/hintColor"
android:maxLength="20"
android:drawableRight="@drawable/ic_name"
android:gravity="center_vertical|right"
android:hint="دوره تکرار"/>
</com.wrapp.floatlabelededittext.FloatLabeledEditTextRightSided>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginRight="5dp"
android:gravity="center_vertical|right">
<Spinner
android:id="@+id/repeat_kind"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/AppTheme"
android:minHeight="25dp"
android:gravity="right"
android:layout_marginRight="5dp"
android:layout_marginLeft="10dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="نوع تکرار"
android:id="@+id/doll_type_tv"
android:textColor="@color/midnight_blue"
android:layout_margin="10dp"
android:gravity="center_vertical"
android:drawableRight="@drawable/ic_doll"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginRight="5dp"
android:gravity="center_vertical|right">
<com.gc.materialdesign.views.ButtonFlat
android:id="@+id/date_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/blue"
android:text="Button"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="تاریخ تکرار"
android:textColor="@color/midnight_blue"
android:layout_margin="10dp"
android:gravity="center_vertical"
android:drawableRight="@drawable/ic_doll"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginRight="5dp"
android:gravity="center_vertical|right">
<com.gc.materialdesign.views.ButtonFlat
android:id="@+id/time_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/blue"
android:text="Button"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="زمان تکرار"
android:textColor="@color/midnight_blue"
android:layout_margin="10dp"
android:gravity="center_vertical"
android:drawableRight="@drawable/ic_doll"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:layout_marginRight="5dp"
android:gravity="center_vertical|right">
<ImageView
android:id="@+id/doll_pic_IV"
android:layout_width="150dp"
android:layout_height="150dp"
style="@style/AppTheme"
android:minHeight="25dp"
android:scaleType="fitXY"
android:gravity="right"
android:layout_marginRight="5dp"
android:layout_marginLeft="10dp"
android:src="@drawable/ic_image_add_to_photos"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="انتخاب صدا"
android:textColor="@color/midnight_blue"
android:layout_margin="10dp"
android:gravity="center_vertical"
android:id="@+id/pic_tv"
android:drawableRight="@drawable/ic_image"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
</LinearLayout>
</ScrollView>