2012-04-09 2 views
0

안녕하세요, 저는이 단추 스타일을 더 구체적으로 '바구니보기'단추로 재구성하려고합니다. waitrose app 단추에는 텍스트 크기와 글꼴 색이 다른 여러 줄의 텍스트가 있어야합니다.멀티 줄 모양의 멀티 스타일 단추

여기까지 코드가 있습니다. 단추 및 해당 디스플레이를 올바르게 만들었지 만 클릭하면 상태가 작동하지 않습니다. 나는 어디가 잘못 됐어. 미리 감사드립니다.

XML 버튼 파일 :

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical" 

    android:state_pressed="true" 
    android:state_focused="true" 
    android:background="@drawable/button_bg" > 

    <TextView 
     android:id="@+id/textView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Some Text" 

    android:state_pressed="false" 
    android:state_focused="false" 
     android:textColor="#ffffff" /> 

    <TextView 
     android:id="@+id/textView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Some Text" 

    android:state_pressed="false" 
    android:state_focused="false" 
     android:textColor="#ffffff" /> 

</LinearLayout> 

java file code: 


    package com.buttons2; 

    import com.buttons2.R; 

    import android.app.Activity; 
    import android.os.Bundle; 
    import android.widget.Button; 

    public class Buttons2Activity extends Activity { 
     /** Called when the activity is first created. */ 
     @Override 
     public void onCreate(Bundle savedInstanceState) { 
      super.onCreate(savedInstanceState); 
      setContentView(R.layout.main); 

      Button button = (Button) findViewById(R.id.button1); 
      setContentView(R.layout.button); 


     } 
    } 

답변

0

나는 당신이 아마 텍스트 & 이미지에 대한 클릭 수를 처리하는 코드를 작성, 특히 주요 컨테이너의 선택/선택되지 않은 상태를 설정하는 것을 사용해야합니다 생각 보기 (정확한 버튼 상태를 보여줍니다).

관련 문제