0

I have seen apps that when run on any device, it feels perfectly to the scree of the device. How do i do something like that: Below is my code. for some smaller device, the layout fits well to the screen. But for Higher Screen Resolution, it does not fit to the screen. How do i make it fit to the screen, and is there any tool i can use to achieve this ?

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="fill_parent"
    android:layout_gravity="center_horizontal"
    android:background="@drawable/bgmenu" >

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        android:background="@drawable/bgmenu" >

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="561dp"
            android:layout_gravity="center_horizontal"
            android:orientation="vertical" >

            <View
                android:layout_width="fill_parent"
                android:layout_height="10dp" />

            <View
                android:layout_width="fill_parent"
                android:layout_height="30dp" />

            <View
                android:layout_width="fill_parent"
                android:layout_height="2dp"
                android:background="#000" />

            <Button
                android:id="@+id/btnHausa"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:onClick="onClick"
                android:text="@string/hausa"
                android:textColor="#FFF"
                android:textStyle="bold" />

            <View
                android:layout_width="fill_parent"
                android:layout_height="2dp"
                android:background="#000" />

            <View
                android:layout_width="fill_parent"
                android:layout_height="15dp" />

            <View
                android:layout_width="fill_parent"
                android:layout_height="2dp"
                android:background="#000" />

            <Button
                android:id="@+id/btnYoruba"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:onClick="onClick"
                android:text="@string/yoruba"
                android:textColor="#FFF"
                android:textStyle="bold" />

            <View
                android:layout_width="fill_parent"
                android:layout_height="2dp"
                android:background="#000" />

            <View
                android:layout_width="fill_parent"
                android:layout_height="15dp" />

            <View
                android:layout_width="fill_parent"
                android:layout_height="2dp"
                android:background="#000" />

            <Button
                android:id="@+id/btnIgbo"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:onClick="onClick"
                android:text="@string/igbo"
                android:textColor="#FFF"
                android:textStyle="bold" />

            <View
                android:layout_width="fill_parent"
                android:layout_height="2dp"
                android:background="#000" />

            <View
                android:layout_width="fill_parent"
                android:layout_height="15dp" />

            <View
                android:layout_width="fill_parent"
                android:layout_height="2dp"
                android:background="#000" />

            <Button
                android:id="@+id/btnPidginEnglish"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:onClick="onClick"
                android:text="@string/PidginEnglish"
                android:textColor="#FFF"
                android:textStyle="bold" />

            <View
                android:layout_width="fill_parent"
                android:layout_height="2dp"
                android:background="#000" />

            <View
                android:layout_width="fill_parent"
                android:layout_height="15dp" />

            <View
                android:layout_width="fill_parent"
                android:layout_height="2dp"
                android:background="#000" />

            <Button
                android:id="@+id/btnEnglish"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:onClick="onClick"
                android:text="@string/english"
                android:textColor="#FFF"
                android:textStyle="bold" />

            <View
                android:layout_width="fill_parent"
                android:layout_height="2dp"
                android:background="#000" />
        </LinearLayout>
    </ScrollView>

    </LinearLayout>
Belvi Nosakhare
  • 3,107
  • 5
  • 32
  • 65
  • 1
    > Hi, try this link.it will help you. [Multiple screen][1] [1]: http://stackoverflow.com/questions/4393732/how-do-you-begin-developing-an-android-app-for-multiple-devices-sizes-densities – Mohan Jan 27 '14 at 05:57

4 Answers4

2

I recommend you to read this documentation http://developer.android.com/guide/practices/screens_support.html

or this article "Designing for Multiple Screens"

http://developer.android.com/training/multiscreen/index.html

M D
  • 47,665
  • 9
  • 93
  • 114
0

You must use different layout folder inside res to fit on multiple screens please go through this http://developer.android.com/guide/practices/screens_support.html

Govind Narayan
  • 91
  • 1
  • 12
0

Instead of using hard code values in attributes like android:layout_height="561dp" you should use android:layout_height="wrap_content" or android:layout_height="match_parent" , as this can be considered as good practice.On the other hand, You can create drawables with standard size provided by google in design guide , putting the drawables in appropriate drawable folder present in res of android project.

Sourabh s
  • 206
  • 1
  • 7
0

The trick lies in the android_manifest.xml Add the follwing to your manifest at root directory of your app:

<activity
       android:name=".Foo"   
       android:label="@string/foo" 
       android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
A Nice Guy
  • 2,676
  • 4
  • 30
  • 54