2010-02-16 38 views
9

Tôi đang sử dụng 3 TextView nghiêng với màu sắc khác nhauAndroid TextView Nghiêng và 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> 

Tôi tự hỏi mỗi ký tự cuối cùng không hiển thị đúng đặc biệt tên được hiển thị ở giữa là "Dan Buckland" cho nó và nó là mất tích cuối cùng nhân vật trông giống như "Dan Bucklano"

Cũng cho tôi biết pls thế nào có thể có TextView nghiêng và đậm cả ..

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

Trả lời

1

Có vẻ như hộp giới hạn không được tính toán chính xác khi sử dụng chữ in nghiêng.

Bạn đã cố gắng sử dụng paddingLeft = 6 và paddingRight = 6 cho các phần tử? (ít bị trùng lặp hơn).

Đối với nhiều phong cách trong một TextView thấy Is it possible to have multiple styles inside a TextView?

+0

Có, tôi đã cố gắng không hoạt động. –

+0

Không hoạt động, cũng như không bao gồmFontPadding – gregm

6

tôi đã có vấn đề chính xác như vậy. Tôi nhận được xung quanh nó bằng cách đơn giản thêm một không gian vào cuối bất kỳ chuỗi nào cần phải in nghiêng.

Nó có thể không phải là giải pháp lâu dài nhất nhưng nó có hiệu quả đối với tôi.

+1

Có, hoạt động. Sử dụng thêm một khoảng trắng hoặc có "fill_parent" làm chiều rộng. Xấu hổ này không được xử lý một cách chính xác bởi Android (tôi là 2.3.7). – shkschneider

+1

Bạn sẽ phải sử dụng \ u0020 để buộc không gian nếu bạn đang sử dụng XML. –

1

Bạn có thể sử dụng &#160; với văn bản trong tệp string.xml.