2011-10-22 117 views
0

我有這樣的Android佈局:佈局問題

main.xml中

<?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" 
    android:id="@+id/mainContainer"> 

    <ImageView android:layout_height="wrap_content" android:id="@+id/imageView1" 
       android:src="@drawable/logo" android:layout_marginTop="30px" 
       android:layout_marginBottom="50px" android:scaleType="fitCenter"  android:layout_width="fill_parent"></ImageView> 

<TextView 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hello" 
    /> 


</LinearLayout> 

這個清單文件:

AndroidManifest.xml中

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
     package="com.mogoolab.android.flowerforyou" 
     android:versionCode="1" 
     android:versionName="1.0"> 
    <uses-sdk android:minSdkVersion="3" /> 

    <application android:icon="@drawable/logo" android:label="@string/app_name"  android:name=".FlowerForYouApp" 
       android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> 

...... 
    </application> 

</manifest> 
我的主要是

佈局不能擴展到HTC Sensation的全部寬度(以及Android 3.0的AVD模擬器),我不知道爲什麼。

在哪裏可以找到一個教程,我如何設計與所有更高Android 1.5版本兼容的Android UI。此外,我需要學習如何設計一個Android UI家庭部件。

謝謝

回答

1

我知道你想要什麼,但你可以在this

而且看一看我不知道這一點:

android:scaleType="fitCenter" in your main.xml 

編輯: 您是否已經閱讀this link

+0

不工作。我的HTC有HDPI密度。我的應用程序將其檢測爲MDPI,並且佈局不會拉伸到最大寬度/高度。 – bogdanmogo

+1

看到我編輯的答案。 – Lars

+0

更新:它與fitCenter一起工作。謝謝。 – bogdanmogo