2014-01-29 7 views
1

나는이 버튼 내가 모든 이미지를 어떻게하면 안드로이드에서이 디자인을 얻을 수 있습니까?

enter image description here

에 대한 다음과 같은 설계를 달성해야합니다. 누름 상태 및 보통 상태의 왼쪽 둥근 이미지 단추 텍스트 배경 이미지이지만 사각형 모양입니다. 내가 선형 레이아웃과 테이블 레이아웃 을 사용하고

이 내가 enter image description here

어떻게

을 얻을 내 XML 코드

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:background="@drawable/stbk" 
android:gravity="center" 
android:orientation="vertical" > 

<TableLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginLeft="20dp" 
    android:layout_marginRight="20dp" 
    android:gravity="center" > 

    <TableRow 
     android:id="@+id/tableRow1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:background="@drawable/scttransband" > 

     <ImageView 
      android:id="@+id/imageView1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@drawable/acc" /> 


     <Button 
      android:id="@+id/accountButton" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:background="@null" 
      android:gravity="left|center" 
      android:paddingLeft="15dp" 
      android:text="My Account" /> 
    </TableRow> 

    <TableRow 
     android:id="@+id/tableRow2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="10dp" 
     android:background="@drawable/scttransband" > 

     <ImageView 
      android:id="@+id/imageView2" 
      android:layout_width="60dp" 
      android:layout_height="64dp" 
      android:src="@drawable/dd" /> 

     <Button 
      android:id="@+id/locateButton" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:background="@null" 
      android:gravity="left|center" 
      android:paddingLeft="15dp" 
      android:text="Locate Branches &amp; ATM" /> 
    </TableRow> 

이 출력입니다 왼쪽 공동을 자르나요? 배경에 대한 rners 및 배경과 왼쪽 이미지 변경과 텍스트 색 변경도 수행하도록 어떻게 눌린 상태로 만들 수 있습니까?

+0

clipdrawable을 사용하는 것이 좋습니다 .. –

+0

나에게 예제를 줄 수 있습니까? – WISHY

+0

여기에 아주 좋은 예가 있습니다 http://blog.mediarain.com/2011/04/android-custom-progressbar-withround-corners/ 도움이되는지 확인하십시오. –

답변

1

아래 코드를 사용해보십시오 : 나는 단지 하나의 항목에 대한 샘플 코드를 작성했습니다

..를

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:padding="8dp" > 

    <TextView 
     android:id="@+id/textView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_centerVertical="true" 
     android:layout_marginLeft="-20dp" 
     android:layout_toRightOf="@+id/imageView1" 
     android:background="YOUR_COLOR" 
     android:gravity="center" 
     android:padding="8dp" 
     android:text="YOUR_TEXT" 
     android:textAppearance="?android:attr/textAppearanceMedium" /> 

    <ImageView 
     android:id="@+id/imageView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_centerVertical="true" 
     android:src="YOUR_CIRCLE_IMAGE" /> 

</RelativeLayout> 

가이 코드를 도움이되기를 바랍니다 ..!

관련 문제