2013-03-26 63 views
1

我正在開發在Xperia Z和Xperia平板Z上運行的Android應用程序。 我的問題是,當AndroidManifest中的anyDensity = true時,Gravity.RIGHT屬性生效,但它anyDensity = false時不起作用。一些最右邊的字符部分隱藏,如下所示。 我嘗試了TextView和Layout中的各種設置更改,但未能全部顯示它們。有人可以告訴我,當anyDensity = false時,我應該設置什麼使Gravity.RIGHT完全工作?當anyDensity = false時Gravity.RIGHT不起作用

謝謝。

`

---------------------------------------- 
<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="#000000" 
    > 

    <TextView 
    android:id="@+id/textDP" 
    android:textStyle="bold" 
    android:typeface="normal" 
    android:textSize="15.125dp" 
    android:textColor="#0000ff" 
    android:background="#cccccc" 
    android:layout_width="200dp" 
    android:layout_height="wrap_content" 
    android:gravity="center_vertical|right" 
    android:layout_marginLeft="50px" 
    android:layout_marginTop="50px" 
    android:text="@string/Sample001" 
    /> 

    <TextView 
    android:id="@+id/textDP" 
    android:textStyle="bold" 
    android:typeface="normal" 
    android:textSize="15.125dp" 
    android:textColor="#0000ff" 
    android:background="#cccccc" 
    android:layout_width="200dp" 
    android:layout_height="wrap_content" 
    android:gravity="center_vertical|right" 
    android:layout_marginLeft="50px" 
    android:layout_marginTop="75px" 
    android:text="@string/Sample002" 
    /> 

    : #Omission 
---------------------------------------- 

`

回答

0

如果你使用Android:anyDensity = 「假」。這會導致您進入舊密度兼容模式,這是您不需要的。而不是設置文本大小/佈局寬度等。與pt使用密度無關的dp。歡呼聲

+0

DP和PT的混合是由於我的反覆試驗,我相信它與這個問題沒有直接關係。有時它們會被正確顯示,但有些時候最右邊的一半字符不會以相同的設置顯示。我沒有理由是什麼導致了這個問題。 – 2013-03-27 02:02:59

相關問題