Android 文本在图像上的位置
我需要在图像上指定位置的文本。 我只发现重力,但它不是我想要的。 有什么方法可以把我的文章写在我想写的地方吗Android 文本在图像上的位置,android,android-layout,Android,Android Layout,我需要在图像上指定位置的文本。 我只发现重力,但它不是我想要的。 有什么方法可以把我的文章写在我想写的地方吗 <Button android:id="@+id/stopButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignPar
<Button
android:id="@+id/stopButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="900dip"
android:layout_marginTop="145dip"
android:background="@drawable/image"
android:contentDescription="@string/stop"
android:textColor="#C0C0C0"
android:gravity="right"
android:textSize="40sp"
android:text="@string/on" />
要在图像上准确定位文本,我建议您实现自己的
可绘制的。它没有那么复杂,也没有很好的记录。然后你会得到一个画布
对象,你可以在上面绘制你的图像和文本,精确地指定放置它的位置。
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_launcher"
android:text="hai"/>
您可以通过可绘制的左、右、下来更改位置。您可以使用FrameLayout。查看教程。以您想要的方式进行修改。您可以使用
android:gravity=“bottom | center|u horizontal”
您可以使用top、right、left来代替bottom。。。您可以使用合理的两种选择。您可以使用framelayout。