【发布时间】:2020-04-01 03:22:09
【问题描述】:
我想在与此类似的 Imageview 左上角的图像上放置 textview。我怎样才能做到这一点。
我有这个代码,但它没有做我想要的。
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/myImageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/myImageSouce"
android:scaleType="centerCrop"/>
<TextView
android:id="@+id/myImageViewText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/spacing_medium"
android:layout_gravity="center"
tools:text="Test"/>
</FrameLayout>
提前感谢您的帮助。
【问题讨论】:
-
另外,为了让你下次问的问题更好,你应该说出代码在做什么以及你期望它做什么,而不是仅仅说“它没有做我想要的”。
标签: java android xml android-layout