Layout issue on HTC Sensation

2019-08-25 00:43发布

问题:

I have this Android layout:

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>

and this manifest file:

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>

My main layout doesn't stretch to full width on a HTC Sensation (and in emulator on AVD with Android 3.0) and I dont know why.

Where I can find a tutorial with how can I design an Android UI compatible with all higher Android 1.5 versions. Also I need to learn how to design an Android UI Home Widget.

Thank you

回答1:

I do know what exactly you want but you could take a look at this

Also i am not sure about this:

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

Edit: Did you already read this link