왜 이런 일이 일어 났는지 설명 할 수 있습니까?특정 배경 자원에서 여백이 작동하지 않습니다.
TextView를 확장하는 상당히 간단한 클래스가 있습니다. 배경색을 Color.BLUE로 설정하면 채우기가 올바르게 작동합니다. 백그라운드 리소스를 android.R.drawable.list_selector_background로 변경하면 더 이상 내 패딩이 적용되지 않습니다. 그게 뭐야? 여기
내 UI 클래스입니다 :public class GhostDropDownOption extends TextView {
TextView text_view;
public GhostDropDownOption(Context context, AttributeSet attrs) {
super(context, attrs);
setup(context);
}
public GhostDropDownOption(Context context) {
super(context);
setup(context);
}
private void setup(Context context) {
this.setClickable(false);
// THE 2 LINES BELOW ARE THE ONLY THING I'M CHANGING
//this.setBackgroundResource(android.R.drawable.list_selector_background);
this.setBackgroundColor(Color.BLUE);
}
}
그리고이 같은 레이아웃을 사용하고 있습니다 :
<trioro.voyeur.ui.GhostDropDownOption
android:id="@+id/tv_dropdown_option_1"
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="@string/request_control_dropdown_option_1"
android:textColor="#000000"
android:padding="10dip"/>
을 그리고 이것은 배경 변화의 결과입니다
을
자세한 내용은 여기에서 확인할 수 있습니다. http://stackoverflow.com/questions/2886140/does-changing-the-background-also-change-the-padding-of-a-linearlayout – TofferJ