2012-02-09 70 views
0

我的TextView及其所有容器被設置爲layout_heightwrap_content。它顯示空間,它的文本(例如:英語)好,但文本沒有任何空間(例如:日本或只是一些長文本沒有它的空間),some text was lost.TextView在沒有空格的情況下顯示長文本時丟失文本

看來,當我追加一條text without space與正常工作兩個空格和一個字母。 OMG,我不知道爲什麼:(

msg += " a"; 

下面是我的佈局。任何幫助將不勝感激!謝謝你

<?xml version="1.0" encoding="UTF-8"?> 

<LinearLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:background="@drawable/push_header_bg" >  
    <ImageView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="0dp" 
     android:layout_marginLeft="1dp" 
     android:layout_marginBottom="0dp" 
     android:src="@drawable/push_logo" /> 
    <TextView 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center"    
     android:gravity="center" 
     android:layout_marginLeft="5dp" 
     android:layout_marginRight="40dp" 
     android:text="@string/app_name" 
     android:textColor="@android:color/white" 
     android:textSize="22dp" 
     android:textStyle="bold" /> 

</LinearLayout> 

<LinearLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:background="@drawable/push_center_bg" 
    android:orientation="vertical" > 
    <TextView 
     android:id="@+id/tv_push_sub_header" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="@string/push_sub_header" 
     android:textSize="20dp"   
     android:layout_marginTop="10dp"   
     android:textColor="@android:color/black" 
     android:textStyle="bold" />  
     <TextView    
      android:id="@+id/tv_push" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content"   
      android:textSize="20dp"    
      android:text="今日は、何事にもパワフルなエネルギーに満ちている1日。また..."    
      android:layout_marginLeft="5dp" 
      android:layout_marginRight="5dp" 
      android:layout_marginTop="10dp"    
      android:textColor="@android:color/black" />  
</LinearLayout> 

<LinearLayout 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal"   
    android:gravity="center"  
    android:paddingLeft="30dp" 
    android:paddingRight="30dp" 
    android:background="@drawable/push_footer_bg" > 
    <Button 
     android:id="@+id/btn_close" 
     android:layout_width="90dp" 
     android:layout_height="wrap_content" 
     android:background="@drawable/button_selector" 
     android:text="@string/push_btn_close" 
     android:textColor="@android:color/white" 
     android:textStyle="bold" 
     android:padding="10dp" 
     android:layout_marginRight="10dp" 
     android:layout_marginLeft="10dp" /> 
    <Button 
     android:id="@+id/btn_open" 
     android:layout_width="90dp" 
     android:layout_height="wrap_content" 
     android:background="@drawable/button_selector" 
     android:text="@string/push_btn_open_app" 
     android:textColor="@android:color/white" 
     android:textStyle="bold" 
     android:padding="10dp" 
     android:layout_marginLeft="5dp" 
     android:layout_marginRight="10dp" /> 

</LinearLayout> 

回答

0

嘗試做這個東西通過本地化

  1. 創建項目中的res文件夾的文件夾值-JA 做出的strings.xml,並把你的日本串這裏

水庫>值-JA>的strings.xml

<string name="TextValue">今日は、何事にもパワフルなエネルギーに満ちている1日。また...</string> 

使用這個「TextValue」在你的layout.xml文件中。像:

<TextView android:id="@+id/textView" android:layout_width="wrap_content" 
    android:text="@string/TextValue" android:layout_height="wrap_content" 
    /> 
+0

謝謝。但是那個字符串只是一個例子,Text字符串將在java代碼中以編程方式設置。 – Wayne 2012-02-09 04:49:18

+0

你正在使用這個應用程序的哪個API? – Andy 2012-02-09 04:55:00

+0

嗨,我用Android 2.2 – Wayne 2012-02-09 05:30:57

0

我不知道我的輸出是否正確與否怎麼我不知道日本,,,但是我在UTF8形式使用日本的數據,並顯示如下(截屏被賦予波紋管)enter image description here

在這個我執行追加和空間。

相關問題