views:

74

answers:

1

Hi,

In emulator, size of edittext and button looks nice but in motorola milestones, both of them are so small. I think there are different types of screen layout. Is it possible to adjust the size automatically? My xml is below :

<?xml version="1.0" encoding="utf-8"?><RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"&gt;
<EditText android:id="@+id/txtToText_e" 
 android:layout_width="270px" 
 android:layout_height="wrap_content" 
 android:textSize="18sp" 
 android:hint="Type To Compose" 
 android:layout_alignParentBottom = "true"
 android:layout_alignParentLeft="true"/>   <Button android:text="Send" 
 android:id="@+id/btnDone_e" 
 android:layout_width="85px" 
 android:layout_height="wrap_content"      
 android:layout_alignParentBottom = "true"
 android:layout_alignParentRight="true"/>                                 

To get the auto re-sized edittext while turning the phone from portrait to landscape, i add these xml code in AndroidManifest.xml

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

But nothing change =[. how to fix it?

Thank you.

A: 

If you want the size to change based on screen density, use dip for dimensions instead of px.

CommonsWare
Now I use 'dip'. When turning the phone from portrait to landscape, I'd like this textbox size to auto adjust depending on screen width. It's still the same size at portrait.
@soclose: You can specify your width using a dimension resource (`res/values/dimens.xml`) and have a different value for landscape (`res/values-land/dimens.xml`). Or, have a different layout for landscape (`res/layout-land/whatever.xml`). There are other possible solutions.
CommonsWare