我正在嘗試對齊屏幕底部不是右側的按鈕,而是在底線之上的一小段距離處。我怎樣才能做到這一點?我已經嘗試了將按鈕垂直和水平居中並且它可以工作,但是我需要將按鈕移動到中心下方或稍微高於底線。在屏幕底部1/3對齊按鈕
我需要移動的「PLAY」按鈕在屏幕上稍低。另外,我還需要將按鈕縮小一點,使其達到當前尺寸的80%。我怎樣才能做到這一點?
<?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:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="acevix.gladiators3.MainActivity">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srcCompat="@drawable/splash"
android:id="@+id/imageView"
android:scaleType="centerCrop"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:adjustViewBounds="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginBottom="50dp"
android:id="@+id/button3"
android:background="@drawable/play" />
</RelativeLayout>
你試過PercentRelativeLayout? https://developer.android.com/reference/android/support/percent/PercentRelativeLayout.html –
我需要在我的RelativeLayout中添加PercentRelativeLayout,我將放置按鈕?對不起,可能愚蠢的問題,我是一個完整的新手 – Radu
你可以顯示你的XML文件請 –