soclose
soclose

Reputation: 2783

auto adjust the size and position of edittext and button

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">
<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.

Upvotes: 2

Views: 3638

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006674

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

Upvotes: 1

Related Questions