在imageview android上写入textview特定位置
我想在imageview的特定位置写入textview。像这个问题有很多答案,但这些答案并没有解决我的问题。要了解我想做什么,请查看这些图片。在imageview android上写入textview特定位置,android,android-layout,android-imageview,textview,Android,Android Layout,Android Imageview,Textview,我想在imageview的特定位置写入textview。像这个问题有很多答案,但这些答案并没有解决我的问题。要了解我想做什么,请查看这些图片。 我想在android上的图片的纸张部分写textview。我使用了下面的代码 <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <ImageView android
我想在android上的图片的纸张部分写textview。我使用了下面的代码
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
**android:layout_height="wrap_content"**
android:src="@drawable/chef_welcome"
android:contentDescription="@string/image_description"
/>
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:padding="20dp"
android:textSize="36sp"
android:text="@string/chef_welcome"
android:layout_centerHorizontal="true"
android:layout_alignBottom="@id/imageView"
/>
</RelativeLayout>
此解决方案适用于任何屏幕大小。当屏幕尺寸较小时,这是正常的。但当尺寸较大时,图像对于屏幕来说非常小。如果我改变
布局高度=“匹配父项”
在这种情况下,textview更改位置与屏幕大小有关。如果我在这种情况下使用边距,当屏幕大小再次改变时,文本视图位置会改变,即使我使用了不同屏幕大小的尺寸xml文件。你有什么解决办法吗?或者建议没有“包裹父母”这样的东西。是的,你的方法会奏效的。您只需添加特定于您将支持的屏幕大小的
padding\u bottom
值(通过创建多个dimens.xml
文件)@verybadalloc感谢您的“wrap\u parent”。使用填充不是解决方案检查此XLE大屏幕至少为960dp x 720dp大屏幕至少为640dp x 480dp正常屏幕至少为470dp x 320dp小屏幕至少为426dp x 320dp您想让我检查什么?