RelativeLayout 中的一个 ImageView 和三个 TextView。
我想要的是使 imageview 和 '6.4MB' TextView 底部对齐。
活动_main.xml
db.collection.aggregate([
{
"$group": {
"_id": { sc: "$school", ay: "$academic_year" },
total: { $sum: 1 }
}
},
{
$group: {
_id: "$_id.sc",
total_students: {
$push: {
_id: "$_id.ay",
total_students: "$total"
}
}
}
}
])
android:layout_alignBottom="@id/screenShot" 不起作用。
有人可以帮忙吗?
答案 0 :(得分:1)
android:layout_alignBottom="@id/screenShot" 不起作用
因为您还添加了 android:layout_below="@id/recordDate"
如果您删除此 layout_below
属性,则 layout_alignBottom
将按预期工作。
但是当您删除 layout_below
时,它可能看起来很奇怪。所以你必须根据那个进行更改
编辑
如果您不想移除 layout_below
,那么向底部添加重力也对您有用。因为这将使文本与底部对齐
android:gravity="bottom"
答案 1 :(得分:0)
Make 很简单,只需使用 LinearLayout 而不是 RelativeLayout 替换代码,并在 linearLayout 中使用 weightSum。删除多余的代码并使其简短。
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="10">
<ImageView
android:id="@+id/screenShot"
android:layout_width="0dp"
android:layout_height="80dp"
android:layout_alignParentLeft="true"
android:layout_marginRight="10dp"
android:layout_weight="2"
android:src="@drawable/screenshot" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="8"
android:orientation="vertical">
<TextView
android:id="@+id/videoName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:text="Video Name"
android:textColor="#000000"
android:textSize="23dp" />
<TextView
android:id="@+id/recordDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:text="2021.05.19 · 5:11"
android:textColor="#797675"
android:textSize="15dp" />
<TextView
android:id="@+id/videoSize"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:text="6.4 MB"
android:textColor="#797675"
android:textSize="15dp" />
</LinearLayout>
</LinearLayout>
答案 2 :(得分:0)
<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_below="@+id/screenShot"
/>
我没有完全理解您的要求,但是如果您想在 ImageView 下方放置 6.4 MB
的文本,您需要更改您的 TextView 属性。