2012-06-15 2 views
0

이런 종류의 이벤트 수행 방법 기본 설정 버튼을 눌렀을 때안드로이드 마켓 UI와 동일한 셀렉터를 다시 만드는 방법은 무엇입니까?

화살표의 배경색 만 변경해야합니다. 나는 텍스트 뷰에 대한 android:background="@null"가 파란색 배경과 전경을 보여주는 작동하지 않는 넣을 때 무슨 짓을

enter image description here

이다.

<LinearLayout 
       android:layout_width="wrap_content" 
       android:layout_height="match_parent" 
       android:layout_centerVertical="true" 
       android:background="@drawable/btn_selector" 
       android:clickable="true" > 

       <ImageView 
        android:id="@+id/back_arrow" 
        android:layout_width="wrap_content" 
        android:layout_height="match_parent" 
        android:src="@drawable/ic_ab_back_holo_dark" /> 

       <TextView 
        android:id="@+id/settings_title" 
        android:layout_width="wrap_content" 
        android:layout_height="match_parent" 
        android:layout_marginLeft="10dp" 
        android:background="@null" 
        android:layout_toRightOf="@id/back_arrow" 
        android:gravity="center_vertical" 
        android:text="@string/settings_title" 
        android:textColor="@color/white" 
        android:textSize="22sp" /> 
      </LinearLayout> 

답변

0

그냥 일반적으로 텍스트 뷰, 검은 색 (# 000000)를 설정하고하여 ImageButton이 드로어 블 선택으로 SRC를 설정 :

<ImageButton android:id="@+id/imageButton" android:layout_width="fill_parent" 
     android:layout_height="wrap_content" android:background="@null" android:gravity="center_horizontal" 
     android:paddingLeft="50dp" android:paddingTop="25dp" android:src="@drawable/button_selector"/> 

선택 :

<?xml version="1.0" encoding="utf-8"?> 
<selector xmlns:android="http://schemas.android.com/apk/res/android"> 
    <item android:state_pressed="true" 
     android:drawable="@drawable/button_pressed"/> 
    <item android:state_pressed="false" 
      android:drawable="@drawable/button_rested"/> 
    <item android:state_enabled="false" 
      android:drawable="@drawable/button_disabled"/> 
</selector> 
0

ImageView의 배경에 상태 목록 드로어 블을 사용합니다 (또는 원하는 경우 버튼으로 변경). 버튼의 배경을 다른 상태 (예 : 눌렀을 때)로 설정할 수 있습니다.

Reference

관련 문제