JibW
JibW

Reputation: 4562

Android support all screen sizes: UIs stretches in Samsung Galaxy Note

In my Android application I have included the followings in the Manifest file.

<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="11"/>

 <supports-screens 
     android:largeScreens="true" 
     android:normalScreens="true" 
     android:smallScreens="true" 
     android:anyDensity="true"/>

Also under the Res folder(UI Design), I have designed separate UIs for the following screen sizes.

layout
layout-large
layout-small

So it works really fine, But in the Samsung Galaxy Note which has a slightly bigger screen(5.3 inches), my UI elements gets stretch and part of it goes beyond the screen limit and become not accesible.

According to the SUPPORTING MULTIPLE SCREENS POST BY ANDROID, this phone should work fine using the layout-large layout resourses and the drawable-xhdpi image resources.

Can't figureout what exacly happens. Any guidance is highly appreciated. Thanks inadvance...!!!!

Edits

Just to test I created another extra set of UIs under layout-large-xhdpi named folder under Res folder as well. So when I test it takes the UIs from this folder but still UI elements Go beyond the screen limit. Also all the width amounts have assigned with dp units.

=== Some Screen shots to explain the problem Situation ===

Following is a screenshot of how it looks(layout-large-xhdpi) in the Graphical layout while designing

enter image description here

<LinearLayout
    android:id="@+id/Layout2"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="20dp">

   <Button
        android:id="@+id/button1"
        android:layout_width="240dp"
        android:layout_height="wrap_content"
        android:text="Account" />

    <Button
        android:id="@+id/button2"
        android:layout_width="240dp"
        android:layout_height="wrap_content"
        android:text="Settings" />       

</LinearLayout>

When it runs it just stretches (following screenshot)

enter image description here

Upvotes: 1

Views: 1541

Answers (1)

mudit
mudit

Reputation: 25534

Try using:

<LinearLayout
    android:id="@+id/Layout2"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="20dp">

   <Button
        android:id="@+id/button1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="Account" />

    <Button
        android:id="@+id/button2"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="Settings" />       

</LinearLayout>

As per the guidelines given by Google, you should avoid using hardcoded pixels in your layout.

refer to this link for more details:

http://developer.android.com/guide/practices/screens_support.html

Upvotes: 4

Related Questions