2011-10-22 120 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