2011-04-06 59 views
1

我有我的應用程序的幾個屏幕,我儘量讓它們適合所有尺寸的屏幕,但沒有成功,所以我附上屏幕,希望求助。我想使這個屏幕分辨率好所有尺寸的屏幕我應該改變

什麼,我想在這個屏幕上得到的是:1, 向widget43上屏幕 2. widget49的頂部在屏幕 3. widget47問題之一的中間的底部即使widget49沒有佔用全部空間,屏幕也是如此。

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
android:id="@+id/widget42" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical" 
xmlns:android="http://schemas.android.com/apk/res/android" 
    > 
<RelativeLayout 
android:id="@+id/widget43" 
android:layout_width="fill_parent" 
android:layout_height="34px" 
android:background="@color/blue" 
    > 
    <TextView 
    android:id="@+id/convertedTitleTextView" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="TextView" 
android:layout_centerVertical="true" 
android:layout_centerHorizontal="true" 
    > 
    </TextView> 
    <Button 
android:id="@+id/convertedBackButton" 
android:layout_width="wrap_content" 
android:layout_height="32px" 
android:layout_alignParentBottom="true" 
android:layout_alignParentLeft="true" 
android:onClick="backButtonOnClick" 
android:text="Back" android:typeface="monospace" android:textColor="@color/white"   android:textColorHint="@color/blue" android:background="@color/blue"> 
</Button> 
<Button 
    android:id="@+id/convertedCancelButton" 
    android:layout_width="wrap_content" 
    android:layout_height="32px" 
android:layout_alignParentBottom="true" 
android:layout_alignParentRight="true" 
android:onClick="cancelButtonOnClick" 
android:text="Cancel" android:background="@color/blue" android:textColor="@color/white"> 
</Button> 
</RelativeLayout> 
<RelativeLayout 
android:id="@+id/widget49" 
android:layout_width="fill_parent" android:layout_gravity="bottom" android:layout_height="310dip"> 
<ListView 
    android:layout_width="fill_parent" 
    android:layout_alignParentTop="true" 
    android:id="@+id/convertedListView" android:hapticFeedbackEnabled="true" 
    android:layout_below="@+id/widget47" android:layout_above="@+id/widget49" android:layout_alignBottom="@+id/widget43" android:layout_height="match_parent"> 
</ListView> 
</RelativeLayout> 
<RelativeLayout android:id="@+id/widget47" android:background="@color/blue" android:layout_width="match_parent" android:layout_height="wrap_content"> 
    <TextView android:layout_centerVertical="true" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_centerHorizontal="true" android:id="@+id/countConvertedTextView" android:text="TextView"></TextView> 
</RelativeLayout> 
</LinearLayout> 

感謝您的幫助!

回答

0

不同的屏幕尺寸有什麼不好?如下所述,最好將不同大小的圖像放在不同的可繪製文件夾中。

繪製 繪製,華電國際 繪製,LDPI 繪製,MDPI

+0

在不同大小屏幕上的Relative_Layout(widget47)並不總是在scr的底部EEN。 – dirko 2011-04-06 06:33:25

+0

首先,您必須將主要線路佈局更改爲相關佈局。那麼你必須在widget27中添加android:layout_alignParentBottom =「true」屬性。現在它會一直到底 – 2011-04-06 06:42:27

+0

我已經做了這樣的結果是Relative_Layout(widget47)將widget49之間的所有空間都放在底部。這意味着是在底部,但是變化是一個錯誤的大小不像我去wrap_content – dirko 2011-04-06 06:53:42

0

做一件事......其中有widget47

android:layout_below="@+id/widget49" 

所以,你的相對佈局ID相對佈局添加該屬性將看起來像

<RelativeLayout android:id="@+id/widget47" 
    android:layout_below="@+id/widget49" android:background="@color/blue" 
    android:layout_width="fill_parent" android:layout_height="wrap_content"> 
+0

一個提示:如果你真的想支持多種屏幕尺寸和方向編碼在dp會給你比px更少的問題... – Prasham 2011-04-06 06:40:48

+0

謝謝,你的解決方案不適合我 – dirko 2011-04-06 07:00:02

+0

有什麼問題嗎?你想讓文本視圖粘在小部件49之下嗎?我試過這段代碼改變了我在片段中顯示的內容,並且它在這裏適用於我。 – Prasham 2011-04-06 07:02:40