[英]Custom Shape Button in Android
How can i make a custom shaped button as i drawn in image in Android? 当我在Android中绘制图像时,如何制作自定义形状的按钮?
I want to implement ui like below. 我想像下面那样实现ui。
Can any one help me ? 谁能帮我 ?
Thanks in advance. 提前致谢。
Here are simple way to implement it just use layout, the works layout is FrameLayout 这是仅使用布局即可实现的简单方法,作品布局为FrameLayout
[Graphical Layout] [图形布局]
[post.png] [post.png]
[add_a_video.png] [add_a_video.png]
[layout.xml] [layout.xml]
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/imageButton4"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:padding="0dp"
android:src="@drawable/add_a_photo" />
<ImageButton
android:id="@+id/imageButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/imageButton1"
android:padding="0dp"
android:src="@drawable/facebook" />
<ImageButton
android:id="@+id/imageButton3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/imageButton2"
android:padding="0dp"
android:src="@drawable/facebook" />
<ImageButton
android:id="@+id/imageButton4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/imageButton2"
android:layout_below="@+id/imageButton2"
android:padding="0dp"
android:src="@drawable/facebook" />
<ImageButton
android:id="@+id/imageButton5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/imageButton3"
android:layout_below="@+id/imageButton3"
android:padding="0dp"
android:src="@drawable/facebook" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/imageButton1" >
<ImageButton
android:id="@+id/imageButton7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="0dp"
android:src="@drawable/post" />
<ImageButton
android:id="@+id/imageButton6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="0dp"
android:src="@drawable/add_a_video" />
</FrameLayout>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.