Q
我想把图像按钮上
0
A
回答
0
可以使用FrameLayout
。在一个FrameLayout
中,z索引是通过在其中添加项的顺序定义,例如
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_text" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/my_drawable"
android:scaleType="fitCenter"/>
</FrameLayout>
在这种情况下,ImageView
将在Button
的顶部可以得出,沿着的底部中心Button
。
3
u可以使用这样的:
android:drawableTop="@drawable/SomeIcon"
,那么你会得到:
<Button
android:id="@+id/damage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="about"
android:drawableTop="@android:drawable/ic_menu_info_details"/>
它为我工作:)
1
您可以检查this thread 基本上,您可以使用:
<ImageButton
android:id="@+id/ImageButton01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/album_icon"
android:background="@drawable/round_button" />
正如线程所说。
1
以RelativeLayout
,将ImageView
置于其中。现在在RelativeLayout上设置onClickListener
。 通过这种方式,你可以创建更复杂的按钮。
<RelativeLayout android:id="@+id/your_btn_id"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true" />
</RelativeLayout>
0
可以使用
android:drawableTop
把绘制在按钮的顶部,并使用适当的填充,使其定位好。
0
<Buttton
android:layout_width="99dp"
android:layout_height="99dp"
android:background = "@drawable/bg" />
bg是您的自定义图像。
相关问题
- 1. 我想移动图像按钮?
- 2. 我想点击切换按钮图像
- 3. 把一个图片按钮上的HTML
- 4. 我想把数字动态地放在图像上
- 5. 我想让我的提交按钮成为一个href图像
- 6. 把图像放在动态创建的按钮上
- 7. 如何把图像放在按钮上? (css)
- 8. 按钮上的图像
- 9. 想随机改变图像在HTML上点击按钮
- 10. 我想链接按钮,并把它放在右边
- 11. 我想在每次点击按钮时更改图像
- 12. 我想让一个图像旋转在一个按钮上点击
- 13. 按钮图像
- 14. 图像按钮,图像resoultion
- 15. 在按钮上添加图像图标?
- 16. 我想删除按钮
- 17. 我想通过按钮
- 18. 我有一个图像,我想成长每次我点击一个按钮
- 19. 我想为我的按钮设置一个背景图像。我崩溃了
- 20. iOS图像按钮按下按钮
- 21. 我想要一个显示并隐藏我的图像的按钮
- 22. UIToolBar按钮图像
- 23. 与按钮图像
- 24. iPhone图像按钮
- 25. Android图像按钮
- 26. 图像和按钮
- 27. Powershell按钮图像
- 28. 图像按钮Ajax.ActionLink
- 29. HTML - 图像按钮
- 30. Android图像按钮
发布你试过的东西.. – 2014-11-06 07:43:00
另一种方法是使用RelativeLayout,将ImageView作为其子。现在把这个RelativeLayout当作一个按钮。 – schnill 2014-11-06 07:49:27