我的应用程序中有一个ScrollView,在其中我创建了一个包含各种元素的线性布局,但问题是我底部的按钮显示不正确。它们在底部被切断。我使用了填充和边距但没有发生任何事情。下面是我的布局
<RelativeLayout 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"
android:background="@color/light_gray">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/dp10">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp20"
android:layout_marginRight="@dimen/dp20"
android:layout_marginTop="@dimen/dp30"
android:orientation="vertical">
<ImageView
android:id="@+id/imgArticleImage"
android:layout_width="match_parent"
android:layout_height="@dimen/dp140"
android:layout_marginBottom="@dimen/dp15"
android:background="@android:color/white"
android:scaleType="fitXY"
android:src="@drawable/banner" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_grey_border_white_bg">
<TextView
android:id="@+id/txtTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/dp5"
android:text="@string/title"
android:textColor="@android:color/black" />
<android.support.design.widget.TextInputLayout
android:id="@+id/ettxtLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtTitle"
android:padding="@dimen/dp5"
app:counterEnabled="true"
app:counterMaxLength="100"
app:counterTextAppearance="@style/TextLimitStyle">
<android.support.design.widget.TextInputEditText
android:id="@+id/etTitile"
android:layout_width="match_parent"
android:layout_height="@dimen/dp80"
android:background="@android:color/transparent"
android:gravity="top"
android:maxLength="100" />
</android.support.design.widget.TextInputLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp20"
android:background="@drawable/bg_grey_border_white_bg">
<TextView
android:id="@+id/txtTitleDes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/dp5"
android:text="@string/start_writing"
android:textColor="@android:color/black" />
<android.support.design.widget.TextInputLayout
android:id="@+id/ettxtLayoutDes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/txtTitleDes"
android:padding="@dimen/dp5"
app:counterEnabled="true"
app:counterMaxLength="1200"
app:counterTextAppearance="@style/TextLimitStyle">
<android.support.design.widget.TextInputEditText
android:id="@+id/etDescription"
android:layout_width="match_parent"
android:layout_height="@dimen/dp140"
android:background="@android:color/transparent"
android:gravity="top"
android:overScrollMode="always"
android:scrollbarStyle="insideInset"
android:scrollbars="vertical" />
</android.support.design.widget.TextInputLayout>
</RelativeLayout>
<LinearLayout
android:id="@+id/layNew"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_margin="@dimen/dp10"
android:gravity="center"
android:orientation="horizontal">
<Button
android:id="@+id/btnSave_draft"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp10"
android:layout_marginRight="@dimen/dp20"
android:background="@android:color/holo_blue_light"
android:paddingLeft="@dimen/dp10"
android:paddingRight="@dimen/dp10"
android:text="@string/save_draft"
android:textColor="@android:color/white" />
<Button
android:id="@+id/btnPublish_article"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:background="@android:color/holo_blue_light"
android:paddingLeft="@dimen/dp10"
android:paddingRight="@dimen/dp10"
android:text="@string/publish_your_article"
android:textColor="@android:color/white"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/layUpdate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_margin="@dimen/dp10"
android:gravity="center"
android:orientation="horizontal"
>
<Button
android:id="@+id/btnDiscardChanges"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp10"
android:layout_marginRight="@dimen/dp20"
android:background="@android:color/holo_blue_light"
android:paddingLeft="@dimen/dp10"
android:paddingRight="@dimen/dp10"
android:text="@string/discard_changes"
android:textColor="@android:color/white" />
<Button
android:id="@+id/btnSaveChanges"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:background="@android:color/holo_blue_light"
android:paddingLeft="@dimen/dp10"
android:paddingRight="@dimen/dp10"
android:text="@string/save_changes"
android:textColor="@android:color/white"
/>
</LinearLayout>
</LinearLayout>
</ScrollView>
<ProgressBar
android:id="@+id/pBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:visibility="gone" />
`
有人能建议我错过了吗?
答案 0 :(得分:0)
在LinearLayout
下填写另一个ScrollView
并提供
paddingBottom
到第二个孩子(第二个LinearLayout)
所以将此添加到添加的 linearLayout: -
android:paddingBottom="20dp"
填充的正确顺序: -
ScrollView
||
LinearLayout X- X -- > padding Bottom wont be applied
||
LinearLayout with paddingBottom -- > is applicable
注意: - paddingBottom
和marginBottom
无法应用于ScrollView
的直接子项。
答案 1 :(得分:0)
删除
$.when.apply($, promises).then(...);
答案 2 :(得分:0)
只需添加android:paddingBottom =&#34; @ dimen / dp30&#34;进入你的LinearLayout:
<RelativeLayout
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"
android:background="@color/light_gray">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/dp10">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/dp20"
android:layout_marginRight="@dimen/dp20"
android:layout_marginTop="@dimen/dp30"
android:orientation="vertical"
android:paddingBottom="@dimen/dp30">