Reputation: 127
I am running a couple of imageviews and a listview in an activity in my app. The display looks perfect in the emulator, which basically displays a short string, two small images at the top and then the rest of the screen consisting of the listview, but when I put it on my device (EVO3D) the listview is cutoff. In fact the width even seems slightly off.
Here is the layout.xml file;
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView android:text="@string/showRunList_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/editText1">
</TextView>
<ImageView android:contentDescription="@string/auxLogo"
android:id="@+id/imageView1"
android:layout_height="wrap_content"
android:src="@drawable/logo_small"
android:layout_width="wrap_content"
android:layout_gravity="center">
</ImageView>
<ImageView android:contentDescription="@string/auxPhone"
android:id="@+id/imageView2" android:layout_height="wrap_content"
android:src="@drawable/phone" android:layout_width="wrap_content">
</ImageView>
<TextView
android:id="@+id/android:empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/main_no_items"/>
<ListView
android:id="@+id/android:list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="bottom|right"
/>
</LinearLayout>
Upvotes: 3
Views: 2512
Reputation: 128428
Let me list out few points to take care off:
Supporting Multiple Screens
.android:layout_height="match_parent"
or android:layout_weight="1"
.dp
or dip
instead of fixed size PX for defining measurements like height/width.sp
(Scaled point) while defining font-size.Upvotes: 1
Reputation: 63293
The resolution/aspect of your emulator is different than the device. The EVO3D has a resolution of 540x960. Your emulator is probably either HVGA (320x480) or WVGA (480x800). This slight variation causes the visible portion of your layout to shift somewhat.
Keep in mind your application will encounter many more device resolution/aspect ratio differences out in the market, so it should react appropriately to these changes.
HTH
Upvotes: 0
Reputation: 6353
You need to add multiscreen support properties into config files and also create different images as per the standard if you want to support multiscreen. Take a look here
Upvotes: 0
Reputation: 1218
check this http://developer.android.com/guide/practices/screens_support.html
Create emulators with same resolution as your device and test it.
Upvotes: 0