2011-08-22 3 views

답변

1

TextView를 연관된 텍스트와 함께 setIndicator (View v) 메서드에 전달합니다. 광범위한 스타일링을 원한다면 대신 자신의 "탭"모델을 매개 변수로 전달하는 것이 좋습니다.

public class Tab extends LinearLayout { 
public Tab(Context c, int drawable, String label) { 
    super(c); 

    TextView tv = new TextView(c); 

    tv.setText(label); 
    tv.setTextColor(getResources().getColorStateList(R.color.tab_text_color)); 
    tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10); 
    tv.setGravity(0x01); 

    setOrientation(LinearLayout.VERTICAL); 

    if (drawable != 0) { 
     ImageView iv = new ImageView(c); 
     iv.setImageResource(drawable); 
     addView(iv); 
    } 
    addView(tv); 
} 

}

+0

덕분에 그것에 대해 많이, 매력처럼 작동합니다. –