activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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/ScreenRecordPage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
tools:context=".MainActivity">
<!-- If you want a button that has a custom background, you could switch the XML element in the layout to be <android.widget.Button> instead of <Button>. -->
<android.widget.Button
android:id="@+id/StartRecord"
android:layout_width="match_parent"
android:layout_height="50dp"
android:textAllCaps="false"
android:background="@drawable/start_record"
android:textSize="30sp"
android:textColor="@color/white"
android:layout_marginTop="8dp"
android:text="Start Record"/>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_marginTop="15dp"
android:layout_height="50dp">
<TextView
android:id="@+id/myRecords"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Total Records"
android:layout_alignParentBottom="true"
android:textColor="@color/black"
android:textSize="20sp" />
</RelativeLayout>
<View
android:layout_marginTop="5dp"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@android:color/darker_gray"/>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_marginTop="15dp"
android:layout_height="match_parent">
<ImageView
android:src="https://bbs.csdn.net/topics/@drawable/screenshot"
android:layout_width="80dp"
android:layout_height="80dp"
android:id="@+id/screenShot"
android:layout_alignParentLeft="true"
android:layout_marginRight="10dp"
/>
<TextView
android:text="Video Name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:textSize="23dp"
android:textColor="#000000"
android:id="@+id/videoName"
android:layout_toRightOf="@id/screenShot"
android:layout_alignParentTop="true"
/>
<TextView
android:text="2021.05.19 · 5:11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:textSize="15dp"
android:textColor="#797675"
android:id="@+id/recordDate"
android:layout_toRightOf="@id/screenShot"
android:layout_below="@id/videoName"
/>
<TextView
android:text="6.4 MB"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:textSize="15dp"
android:textColor="#797675"
android:id="@+id/videoSize"
android:layout_toRightOf="@id/screenShot"
android:layout_below="@id/recordDate"
android:layout_alignBottom="@id/screenShot"
/>
</RelativeLayout>
</LinearLayout>
如何使6.4MB跟圖片底部對齊?

uj5u.com熱心網友回復:
android:layout_alignBottom="@id/screenShot" does not work
Because You also have added android:layout_below="@id/recordDate"
If You will remove this layout_below property then layout_alignBottom will work as expected.
But when You will remove layout_below, then it may look strange. So You have to make changes according to that
EDIT
If You do not want to remove layout_below, then may be adding gravity to bottom will also work for You. As this will align the text to the bottom
android:gravity="bottom"
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/285179.html
標籤:Android
上一篇:關于兩個對話框的位置問題
