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. android-想把按钮放在listview上面
- 2. 我想点击切换按钮图像
- 3. 我想移动图像按钮?
- 4. 我想同时更改图像按钮的图像onClick事件
- 5. 我想改变按钮的图像。当我点击图片
- 6. 如何把按钮和图像的UIScrollView
- 7. 把一个图片按钮上的HTML
- 8. 我想把数字动态地放在图像上
- 9. 我想让我的提交按钮成为一个href图像
- 10. 把图像放在动态创建的按钮上
- 11. 如何把图像放在按钮上? (css)
- 12. 我想在html上创建按钮,但我无法调整到图像
- 13. 按钮上的图像
- 14. JOptionPane图像在按钮上?
- 15. 想要更改按钮单击图像视图内的图像
- 16. getorgchart库:我怎么能把图片上的按钮/链接
- 17. 我想从你的隐藏按钮上
- 18. 我想链接按钮,并把它放在右边
- 19. 我想使滚动图像onclick按钮使用android
- 20. 我想在每次点击按钮时更改图像
- 21. 想随机改变图像在HTML上点击按钮
- 22. 安卓:我想要一个(N)(图像)两个图像按钮就可以了
- 23. 我想让一个图像旋转在一个按钮上点击
- 24. 旋转按钮上的图像按
- 25. 按钮图像
- 26. 我想通过按钮
- 27. 我想删除按钮
- 28. 图像按钮,图像resoultion
- 29. 在按钮上添加图像图标?
- 30. 我想为我的按钮设置一个背景图像。我崩溃了
发布你试过的东西.. – 2014-11-06 07:43:00
另一种方法是使用RelativeLayout,将ImageView作为其子。现在把这个RelativeLayout当作一个按钮。 – schnill 2014-11-06 07:49:27