0

I have 2 devices. For bigger screen size, my layout is having a white gap at the bottom. I designed Manisfest.xml as if it is screen configuration issue:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mapcard"
android:versionCode="1"
android:versionName="1.0"
 >

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

And this is my layout which i am having problem. For Galaxy S2 works fine but when it comes to HTC Butterfly S layout aligns more to right and white gap appears at the bottom:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/sview" >

<RelativeLayout
android:id="@+id/rl"
android:layout_width="match_parent"
android:layout_height="461dp"
android:background="@drawable/mainpagebck"
android:gravity="clip_horizontal"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin" >

<ImageView
    android:id="@+id/qrcodeview"
    android:layout_width="120dp"
    android:layout_height="105dp"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true"
    android:src="@drawable/border"
    android:adjustViewBounds="true"
    android:scaleType="fitCenter" >
</ImageView>
 <ImageView
    android:id="@+id/logoview"
    android:layout_width="120dp"
    android:layout_height="105dp"
    android:layout_alignLeft="@+id/txtName"
    android:layout_alignParentTop="true"
    android:src="@drawable/border"
    android:adjustViewBounds="true"
    android:scaleType="fitCenter" />

<TextView
    android:id="@+id/txtqrcode"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBottom="@+id/qrcodeview"
    android:layout_alignLeft="@+id/qrcodeview"
    android:layout_marginBottom="41dp"
    android:layout_marginLeft="32dp"
    android:text="QR Code"
    android:fitsSystemWindows="true"
    android:textAppearance="?android:attr/textAppearanceSmall" />

<TextView
    android:id="@+id/txtlogo"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBaseline="@+id/txtqrcode"
   android:layout_marginBottom="41dp"
    android:layout_marginLeft="23dp"
    android:layout_toRightOf="@+id/linearLayout1"
    android:text="Logo/Photo"
    android:fitsSystemWindows="true"
    android:textAppearance="?android:attr/textAppearanceSmall" />

<ImageView
    android:id="@+id/location"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBottom="@+id/qrcodeview"
    android:layout_alignParentTop="true"
    android:layout_toLeftOf="@+id/qrcodeview"
    android:layout_toRightOf="@+id/logoview"
    android:src="@drawable/location1" />



  <EditText
    android:id="@+id/txtName"
    android:layout_width="288dp"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_below="@+id/logoview"
    android:ems="10"
    android:hint="Full Name"
    android:capitalize="words"
    android:textColorHint="#262d35" />

  <EditText
    android:id="@+id/txtCompany"
    android:layout_width="288dp"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_below="@+id/txtName"
    android:ems="10"
    android:hint="Company"
    android:capitalize="characters"
    android:textColorHint="#262d35" />

  <EditText
    android:id="@+id/txtPhone"
    android:layout_width="288dp"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_below="@+id/txtCompany"
    android:ems="10"
    android:hint="Phone (Landline/Fax)"
    android:inputType="phone"
    android:textColorHint="#262d35" />

  <EditText
    android:id="@+id/txtMobile"
    android:layout_width="288dp"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_below="@+id/txtPhone"
    android:ems="10"
    android:hint="Mobile"
    android:inputType="phone"
    android:textColorHint="#262d35" />

 <EditText
    android:id="@+id/txtAddress"
    android:layout_width="288dp"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_below="@+id/txtMobile"
    android:ems="10"
    android:hint="Address"       
    android:capitalize="words"    
    android:textColorHint="#262d35" /> 


<EditText
    android:id="@+id/txtEmail"
    android:layout_width="288dp"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_below="@+id/txtAddress"
    android:ems="10"
    android:hint="E-mail"
    android:capitalize="none"
    android:inputType="textEmailAddress"
    android:textColorHint="#262d35" >


</EditText>

<EditText
    android:id="@+id/txtWebsite"
    android:layout_width="288dp"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_below="@+id/txtEmail"
    android:ems="10"
    android:hint="Website"
    android:capitalize="none"
    android:textColorHint="#262d35"
    android:inputType="textEmailAddress"
     />

<EditText
android:id="@+id/txtTitle"
android:layout_width="246dp"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/txtWebsite"
android:layout_alignParentRight="true"
android:layout_below="@+id/txtWebsite"
android:ems="10"
android:hint="Title"
android:capitalize="words"
android:textColorHint="#262d35" >


</EditText>

<LinearLayout
android:id="@+id/linearlayout2"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_below="@+id/txtTitle" >

<Button
    android:id="@+id/save"
    style="?android:attr/buttonStyleSmall"
    android:layout_width="140dp"
    android:layout_height="wrap_content"
    android:text="Save" />

 <Button
        android:id="@+id/clear"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="148dp"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:text="Clear" />

</LinearLayout>
</RelativeLayout>

Screen captures:

HTC and Galaxy S2

White gap is below Save and Clear button on 1st image and above texts are not proper aligned. How i can fix this? Thank you for suggestions.

Umit Kaya
  • 5,771
  • 3
  • 38
  • 52
  • 1
    can you please show some screenshots of both devices? also, btw, the manifest only tells which screen sizes the app will be supported on, and not how it will perform on those devices. – android developer Jan 11 '14 at 21:43

1 Answers1

0

Use match_parent for height. Basically, you specified a maximum height of 461dp for a relative layout, I can't think of a case where the main layout of a program should ever have a specified height, usually you want to use fill_parent.

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/sview" >

<RelativeLayout
android:id="@+id/rl"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/mainpagebck"
android:gravity="clip_horizontal"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin" >

Furthermore, you use pixel heights constantly in your view, you probably don't want to do that. It will cause slight layout issues with every device, and no one builds a layout for every single screen layout (At least, not that I'm aware of...)

PearsonArtPhoto
  • 38,970
  • 17
  • 111
  • 142