我很难将我的按钮与“login_password”的底部对齐我试过 endOf 并且它根本不起作用并且在父级的底部对齐并且它似乎没有任何工作。我尝试使用边距将其移动到底部,但它只会破坏用户名文本框。我遇到的问题有什么解决方案吗?
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/myBlue"
android:orientation="vertical"
android:gravity="center"
tools:context="com.vice.jake.ric.fads.view.activites.MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:layout_toStartOf="@id/relativelayout1"
android:layout_marginBottom="275dp"
android:id="@+id/relativelayout1">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:src="@drawable/logov3_4" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerVertical="true"
android:id="@+id/relativelayout2">
<EditText
android:id="@+id/login_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:background="@drawable/luxx_edittext"
android:drawableStart="@drawable/ic_person_outline_black_24dp"
android:drawablePadding="15dp"
android:hint="Username"
android:padding="16dp" />
<EditText
android:id="@+id/login_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginTop="112dp"
android:background="@drawable/luxx_edittext"
android:drawableStart="@drawable/ic_lock_outline_black_24dp"
android:drawablePadding="15dp"
android:hint="Password"
android:padding="16dp" />
<Button
android:id="@+id/button_redirect_register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/holo_red_light"
android:layout_toEndOf="@id/login_password"
android:text="REGISTER"
android:textColor="@color/ghostWhiteColor" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Don't have an Account? Create one!"
android:textColor="@color/ghostWhiteColor"
android:layout_centerHorizontal="true"
android:padding="20dp"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
</RelativeLayout>
试试这个
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorAccent"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginBottom="275dp"
android:src="@drawable/places_ic_search" />
<LinearLayout
android:id="@+id/relativelayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="vertical">
<EditText
android:id="@+id/login_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:background="@color/colorAccent"
android:drawablePadding="15dp"
android:drawableStart="@drawable/places_ic_clear"
android:hint="Username"
android:padding="16dp" />
<EditText
android:id="@+id/login_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:background="@color/colorPrimary"
android:drawablePadding="15dp"
android:drawableStart="@drawable/places_ic_clear"
android:hint="Password"
android:padding="16dp" />
<Button
android:id="@+id/button_redirect_register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toEndOf="@id/login_password"
android:background="@color/colorAccent"
android:text="REGISTER"
android:textColor="#ff00" />
</LinearLayout>
<TextView
android:id="@+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:padding="20dp"
android:text="Don't have an Account? Create one!"
android:textColor="#ff00" />
</RelativeLayout>
输出
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句