2015-02-05 6 views
1

Android에서 이미지로 그려진 맞춤 모양 버튼을 만들 수 있나요?Android의 맞춤 모양 버튼

아래처럼 UI를 구현하고 싶습니다. enter image description here

아무도 도와 줄 수 있습니까?

미리 감사드립니다. 여기

+0

될 것 하드 물건을 ... 당신은 사용자 정의 뷰의 onDraw는 당신의 자신의 뷰를 그릴 수 있습니다 또는 당신은이 ImageButton을 사용하고 좋은 드로잉 프로그램을 사용하여 직접 그릴 수 있습니다. – Opiatefuchs

답변

1

가 그냥 레이아웃을 사용하여 구현하는 간단한 방법입니다, 작품의 레이아웃은 FrameLayout이

입니다

[그래픽 레이아웃] Graphical Layout

[post.png]

post.png

[add_a_video.png]

enter image description here

[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>