我想知道如何讓應用程序在不同的設備上看起來相同。我多次閱讀Supporting Multiple Screens,但我仍然無法理解如何生活。在不同的設備上使文本大小相同
下面是一個示例佈局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hello World, MyActivity"
android:textSize="30sp"
/>
</LinearLayout>
有銀河S II(480×800)和感覺XE(540x960)。它們都是hdpi
,物理屏幕尺寸幾乎相同。我希望看到同樣看好這兩個設備,但實際上在540x960的文字較小然後在480×800: (左邊是480×800,右邊是540x960)
我試圖指定文字大小尺寸的資源,使獨立文件夾values-w540dp
但它沒有效果。
你們如何讓你的應用在不同的hdpi
設備上看起來一樣?使用屏幕的高度和寬度:here.Otherwise你一些比(TEXTSIZE =因子*高度或因子可以生成等)必須設置你的佈局動態地
技術上那些事情2是相等的。它可以使文本具有相同的大小,但不能使較小的屏幕更寬。:)請注意,「Hello」大概在「Demo」結尾的同一位置結束? –