[英]I can't place textview under my Image in Android Studio?
<TextView
android:id="@+id/textView27"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="TextView" />
I use this code for TextView我将此代码用于 TextView
Simplest way is to add DrawableTop:最简单的方法是添加 DrawableTop:
<TextView
android:id="@+id/textView27"
android:drawableTop="@drawable/yourimage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TextView" />
I also saw you have 0dp width and wrap_content, I am assuming you are using layout weights, and not constraint layout.我还看到您有 0dp 宽度和 wrap_content,我假设您使用的是布局权重,而不是约束布局。 So please do experiment with that.
所以请尝试一下。
You can also add android:drawablePadding="dp"
to add padding in image to text.您还可以添加
android:drawablePadding="dp"
将图像中的填充添加到文本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.