-3

I used sp for text font size and dp for everything else, but still when i run my app on small screen size phone the image and text on my first page goes below screen and is partially visible...plz provide me some help in figuring out what should i change in below code..i am a beginner

This is my xml file for displaying image and some text below it:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/back2"
android:orientation="vertical"
android:paddingTop="120dp" >

<ImageView
    android:contentDescription="@string/app_name"
    android:id="@+id/imageView1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:src="@drawable/welcome" />

<TextView
    android:id="@+id/textView1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:gravity="center"
    android:paddingTop="50dp"
    android:text="@string/mats"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textColor="@color/red"
    android:textSize="35sp"
    android:textStyle="bold"
    android:layout_below="@+id/imageView1"
     />

</RelativeLayout>

This is my xml for listView:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".ListActivity"

 >  


 <ListView
    android:id="@+id/list"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:padding="20dp"
    android:gravity="center" 
    android:background="@drawable/shape"
    android:drawSelectorOnTop="true" 
    >
    </ListView>
   <TextView
    android:textIsSelectable="false"
    android:paddingBottom="20dp"
    android:textSize="40sp"
    android:id="@+id/textItem"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:textColor="#FFFFFF"

    />

</LinearLayout> 
userb
  • 25
  • 2
  • 8

1 Answers1

-1

Use specified directories for layout and values for different screen size. Look here: Screen size

Orest Savchak
  • 4,529
  • 1
  • 18
  • 27