我正在尝试在ImageButton的图像上方写文本。
我一直在互联网上四处逛逛,我知道您无法设置ImageButtons文本。每个人都建议我改用Button并设置其背景,但他们忽略了以下事实:如果我这样做,则按钮本身将成为可点击的图像(我希望将图像绘制在android按钮图像之上,不只是图像本身)。还有其他方法吗?如果可能的话,我也想避免使用FrameLayouts。
到目前为止,FramLayout是执行此操作的最佳方法。这段代码应该完成它
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="somethingHere" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
android:background="somethingHere"/>
</FrameLayout>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句