के साथ काम नहीं करता है क्या कोई मुझे बता सकता है कि यह क्यों हो रहा है?पैडिंग कुछ पृष्ठभूमि संसाधन
मेरे पास टेक्स्टव्यू का विस्तार करने वाला एक साधारण सरल वर्ग है। जब मैं रंगीन रंग को पृष्ठभूमि रंग सेट करता हूं, तो पैडिंग ठीक काम करता है। जब मैं पृष्ठभूमि संसाधन को android.R.drawable.list_selector_background में बदलता हूं, तो मेरा पैडिंग अब लागू नहीं होता है। एफ क्या है?
यहाँ मेरी यूआई वर्ग है:
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