【发布时间】:2018-08-31 05:27:04
【问题描述】:
今天过得怎么样。
我想知道我今天卡在哪里。我在列表中获取图像和文本的 json,我的图像是圆形的。当我得到带有文本的图像时,它看起来很糟糕,因为文本不在 imageview 下方的中心。对此进行了很多搜索,但我没有找到。我只是在父级“true”中找到了重力“中心”和中心,我尝试了这两个但我没有得到解决方案。我的代码是:-
<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"
tools:context=".MainActivity>
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="110dp"
android:layout_height="110dp"
android:layout_marginTop="70dp"
android:layout_marginStart="15dp"
android:id="@+id/img_design" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/img_design"
android:id="@+id/design_color"
android:text=" "
android:layout_centerInParent="true"
android:textStyle="bold"
android:textSize="15sp" />
</RelativeLayout>
我想在图像中间自动设置这样的文本,因为文本的长度不是固定的:
IMAGEVIEW
text
请指导我,建议我并解决这个问题,如果您对我的问题有任何疑问,请询问我。谢谢。
【问题讨论】:
-
因为它在 UI 上,请附上一张显示问题的图片,可能还有一张显示您想要完成的操作
-
先生,它完成了谢谢你尝试解决我的问题。
标签: android android-layout android-imageview textview