2010-02-16 16 views
9

मैं अलग अलग रंगएंड्रॉयड TextView इटैलिक और wrap_contents

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="fill_parent" android:layout_height="wrap_content" 
      android:orientation="horizontal" android:id="@+id/submittedBy" android:paddingTop="10dip"> 


      <ImageView android:id="@+id/subByImg" 
       android:layout_width="wrap_content" android:layout_height="wrap_content" 
       android:gravity="left" android:layout_gravity="bottom" android:src="@drawable/submitted_by_arrow"/> 
      <TextView android:id="@+id/submitLabel" 
       android:layout_width="wrap_content" android:layout_height="wrap_content" 
       android:gravity="left" android:text="Submitted by" android:textStyle="italic" 
       android:textSize="12sp" android:textColor="@color/gray" android:paddingLeft="5dip"/> 
      <TextView android:id="@+id/submitName" android:textStyle="italic" 
       android:layout_width="wrap_content" android:layout_height="wrap_content" 
       android:textSize="12sp" android:textColor="@color/maroon_dark" android:paddingLeft="10dip"/> 
       <TextView android:id="@+id/submitByDate" android:textStyle="italic" 
       android:layout_width="wrap_content" android:layout_height="wrap_content" 
       android:gravity="left" 
       android:textSize="12sp" android:textColor="@color/gray" android:paddingLeft="10dip"/> 
      </LinearLayout> 

मुझे आश्चर्य है कि हर अंतिम वर्ण दिखाई नहीं दे रहा ठीक से विशेष रूप से बीच डिस्प्ले नाम के साथ 3 इटैलिक textviews उपयोग कर रहा हूँ "दान बकलैंड" है और यह यह पिछले याद आ रही है चरित्र .. "दान Bucklano"

इसके अलावा मुझे बताओ pls कैसे TextView इटैलिक और बोल्ड दोनों हो सकते हैं की तरह लग रहा

alt text http://www.freeimagehosting.net/uploads/953d573113.jpg

उत्तर

1

ऐसा लगता है कि इटैलिक का उपयोग करते समय बाउंडिंग बॉक्स की सही गणना नहीं की जाती है।

क्या आपने तत्वों के लिए पैडिंग लेफ्ट = 6 और पैडिंग राइट = 6 का उपयोग करने का प्रयास किया है? (ओवरलैप का कम मौका)।

एक TextView में कई शैलियों के लिए Is it possible to have multiple styles inside a TextView?

+0

हाँ मैंने काम नहीं करने की कोशिश की। –

+0

काम नहीं करता है, न ही इसमें शामिल है फोंटपैडिंग – gregm

6

मैं ठीक उसी समस्या थी देखते हैं। मैं इटालिक्स में होने वाली किसी भी स्ट्रिंग के अंत में बस एक जगह जोड़ कर इसके चारों ओर मिल गया।

यह सबसे लंबा दीर्घकालिक समाधान नहीं हो सकता है लेकिन यह मेरे लिए काम करता है।

+1

हां, यह काम करता है। एक अतिरिक्त स्थान का उपयोग करें या चौड़ाई के रूप में "fill_parent" है। शर्मिंदा यह एंड्रॉइड द्वारा सही ढंग से संभाला नहीं जाता है (मेरा 2.3.7 है)। – shkschneider

+1

यदि आप एक्सएमएल का उपयोग कर रहे हैं तो आपको स्पेस को मजबूर करने के लिए \ u0020 का उपयोग करना होगा। –

1

आप स्ट्रिंग.एक्सएमएल फ़ाइल में पाठ के साथ &#160; का उपयोग कर सकते हैं।

संबंधित मुद्दे