Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何将按钮或文本视图放置在布局的绝对底部?_Android_Xml_Android Layout_Textview_Android Relativelayout - Fatal编程技术网

Android 如何将按钮或文本视图放置在布局的绝对底部?

Android 如何将按钮或文本视图放置在布局的绝对底部?,android,xml,android-layout,textview,android-relativelayout,Android,Xml,Android Layout,Textview,Android Relativelayout,布局中似乎有一些隐藏的填充,对吗 我有一个文本视图: <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:background="@color/green" android:text="LOG IN"/> 不会一直向下放置文本视

布局中似乎有一些隐藏的填充,对吗

我有一个文本视图:

    <TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:background="@color/green"
    android:text="LOG IN"/>
不会一直向下放置文本视图。 参考图像:


有没有办法去掉这个填充物?

我的问题的答案很简单,由@Marco Dufal提供

进入res/values文件夹中的dimens.xml并将边距设置为0dp:

<dimen name="activity_horizontal_margin">0dp</dimen>
<dimen name="activity_vertical_margin">0dp</dimen>
0dp
0dp

这里,TextView的父对象是整个RelativeLayout

TextView确实位于RelativeLayout的底部,但并不意味着RelativeLayout的底部与屏幕的绝对底部对齐

尝试为您的亲戚设置android:layout_marginBottom=“0px”


顺便说一句,在版面和内部视图之间使用填充,在版面和屏幕边框之间的外部使用边距使用此代码,如果发现任何问题,请务必通知我。。。谢谢

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="2dp" >

<ImageView
    android:id="@+id/picture"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scaleType="centerCrop" />

<TextView
    android:id="@+id/text"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignBottom="@+id/picture"
    android:layout_gravity="bottom"
    android:background="@drawable/grid_text_back"
    android:paddingBottom="15dp"
    android:paddingLeft="10dp"
    android:paddingRight="10dp"
    android:paddingTop="15dp"
    android:textColor="@android:color/white"
    android:textStyle="bold" />


尝试在
res/values
文件夹下检查
dimens.xml
。真不敢相信我在任何地方都找不到答案是的我也有同样的问题。。。Android studio自动生成它。。我想您可以通过检查布局xml来解决这个问题。。。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="2dp" >

<ImageView
    android:id="@+id/picture"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scaleType="centerCrop" />

<TextView
    android:id="@+id/text"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignBottom="@+id/picture"
    android:layout_gravity="bottom"
    android:background="@drawable/grid_text_back"
    android:paddingBottom="15dp"
    android:paddingLeft="10dp"
    android:paddingRight="10dp"
    android:paddingTop="15dp"
    android:textColor="@android:color/white"
    android:textStyle="bold" />