本文介绍了安卓的ImageView与TextView的底部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想放置图像与图像下方的标签,我一直在尝试了很多,但不能prevent重叠的图像和文字,
这里是我的layout.xml
I am trying to place an image with a label below the image, I have been trying a lot but couldn't prevent the image and text from overlapping,Here is my layout.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center" >
<ImageView
android:id="@+id/grid_item_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="15dp"
android:paddingLeft="15dp"/>
<TextView
android:id="@+id/grid_item_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="center"
android:singleLine="true"
android:layout_marginLeft="20dp"
android:paddingLeft="15dp"
android:textSize="20dp">
</TextView>
推荐答案
添加到您的的TextView
安卓这样的:layout_below =@ + ID / grid_item_image
和删除安卓重力=中心
从的TextView
add this into your TextView
android:layout_below="@+id/grid_item_image"
and remove the android:gravity="center"
from TextView
这篇关于安卓的ImageView与TextView的底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!