Thursday 15 January 2015

layout - how to set custom drawable background on android? -


मेरे पास यह संसाधन है छवि विवरण यहां दर्ज करें

मैं अपनी सूची आइटम पृष्ठभूमि के रूप में इस 9 पैच वाली छवि का उपयोग करता हूं लेकिन मेरे लेआउट एक्सएमएल पर ऐसा कुछ गलत हो गया था:

यहाँ छवि विवरण दर्ज करें

जैसा कि आप देख सकते हैं, सामग्री को बॉक्स के अंदर ठीक से नहीं रखा गया है। यह मैं कैसे मेरी सूची आइटम लेआउट परिभाषित करता है:

  & lt;? Xml संस्करण = "1.0" एन्कोडिंग = "यूटीएफ -8"? & Gt; & LT; RelativeLayout xmlns: एंड्रॉयड = "http://schemas.android.com/apk/res/android" एंड्रॉयड: layout_width = "match_parent" एंड्रॉयड: layout_height = "wrap_content" एंड्रॉयड: गद्दी = "10dp" एंड्रॉयड: पृष्ठभूमि = " @ एंड्रॉइड: रंग / पारदर्शी "& gt; & LT; imageView एंड्रॉयड: आईडी = "@ + id / item_image" एंड्रॉयड: layout_width = "50dp" एंड्रॉयड: layout_height = "50dp" एंड्रॉयड: layout_alignParentLeft = "true" एंड्रॉयड: layout_alignParentTop = "true" / & gt; & LT; LinearLayout एंड्रॉयड: layout_width = "wrap_content" एंड्रॉयड: layout_height = "wrap_content" एंड्रॉयड: layout_marginLeft = "10dp" एंड्रॉयड: गद्दी = "5dp" एंड्रॉयड: अभिविन्यास = "ऊर्ध्वाधर" एंड्रॉयड: layout_alignParentTop = "true" एंड्रॉयड: layout_toRightOf = " @ + Id / item_image "एंड्रॉइड: पृष्ठभूमि =" @ ड्रॉएबल / चैट_ बाइट "& gt; & LT; TextView एंड्रॉयड: आईडी = "@ + id / item_text_1" एंड्रॉयड: layout_width = "wrap_content" एंड्रॉयड: layout_height = "wrap_content" एंड्रॉयड: पाठ-शैली = "बोल्ड" एंड्रॉयड: textcolor = "# 8cc751" एंड्रॉयड: textSize = "20sp" एंड्रॉइड: टेक्स्ट = "नाम" / & gt; & LT; TextView एंड्रॉयड: आईडी = "@ + id / item_text_2" एंड्रॉयड: layout_width = "wrap_content" एंड्रॉयड: layout_height = "wrap_content" एंड्रॉयड: layout_marginTop = "5dp" एंड्रॉयड: textcolor = "# 909,090" एंड्रॉयड: textSize = "14sp" एंड्रॉइड: टेक्स्ट = "संदेश" / & gt; & Lt; / LinearLayout & gt; & Lt; / RelativeLayout & gt;   

मुझे नहीं पता कि यह क्यों हो रहा है। कोई उपाय? धन्यवाद!

9 पैच छवि सिर्फ पृष्ठभूमि है आपको अपने विचारों को समायोजित करना होगा देखें .. आपकी छवि M से सीधे नीचे N पर जाएं। इसलिए आप अपना दूसरा textview ले जा सकते हैं या कुछ पिक्सेल के लिए, उदाहरण के लिए आप मार्जिन लेफ्ट

   id = "@ + id / item_text_2" एंड्रॉयड: layout_width = "wrap_content" एंड्रॉयड: layout_height = "wrap_content" एंड्रॉयड: layout_marginTop = "5dp" एंड्रॉयड: layout_marginLeft = "5dp" एंड्रॉयड: textcolor = "# 909,090" एंड्रॉयड: textSize = " 14sp "एंड्रॉइड: टेक्स्ट =" संदेश "/ & gt;   

मुझे आशा है कि यह सुझाव आपकी सहायता करेगा।

No comments:

Post a Comment