2010-11-29 3 views
0

У меня есть проблема, которую я не могу разрешить с помощью полей EditText в моих представлениях. Если я просматриваю какие-либо мои взгляды в затмении, коробки EditText выглядят отлично на маленьких и больших экранах и кажутся масштабируемыми, как ожидалось. Но на маленьких экранах они выглядят большими по высоте на экране. Они, похоже, масштабируются по ширине, но растут по высоте, оставляя больше поля между текстом и границей.EditText box не масштабируются на маленьких экранах

XML-очень мало:

<EditText android:id="@+id/width" 
android:layout_height="wrap_content" 
android:layout_width="fill_parent" 
android:hint="Slab Width (mm)" 
android:inputType="phone" 
> 
</EditText> 

Я бы ожидал, что коробка будет масштабироваться по высоте в соответствии с экрана. Я удивлен, что он не масштабируется по высоте. Я в шоке, он становится больше в физической высоте ... ????

Малый экран: http://www.doobox.co.uk/rapidimages/smallscreen.png

редактировать: Ее на самом деле QVGA & WQVGA экранов, которые имеют эту проблему ..!

Я думаю, ваш будет нуждаться в полной XML:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
android:id="@+id/widget36" 
android:background="@drawable/linen_bg" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
xmlns:android="http://schemas.android.com/apk/res/android" 
> 
<LinearLayout 
android:id="@+id/main_linear" 
android:layout_width="fill_parent" 
android:orientation="vertical" 
android:layout_alignParentTop="true" 
android:layout_alignParentLeft="true" 
android:layout_marginLeft="20dip" android:layout_marginRight="20dip" android:layout_height="wrap_content"> 
<ImageView 
android:id="@+id/logo" 
android:background="@drawable/conc_logo" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:layout_gravity="center_horizontal" 
android:layout_marginTop="15dip" 
> 
</ImageView> 
<TextView android:text="Slab Calculator" 
android:id="@+id/TextView01" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:layout_gravity="center_horizontal" 
android:textSize="20sp" 
android:textColor="#333333" 
android:layout_marginTop="20dip"> 
</TextView> 



<EditText android:id="@+id/length" 
android:layout_width="fill_parent" 
android:inputType="phone" 
android:fitsSystemWindows="true" 
android:hint="Height of Slab (mm)" 
android:layout_height="wrap_content"> 
</EditText> 



<TextView android:text="**.** Cubic Meter's" 
android:id="@+id/slab_result" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:textSize="20sp" 
android:textColor="#333333" 
android:layout_marginTop="5dip"> 
</TextView> 

<TextView android:text="£**.** Total" 
android:id="@+id/slab_cost" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:textSize="20sp" 
android:textColor="#333333" 
android:layout_marginTop="5dip"> 
</TextView> 
</LinearLayout> 
<RelativeLayout android:id="@+id/bottom_container" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:padding="20dip" 
android:layout_alignParentBottom="true" 
android:layout_centerHorizontal="true" 
> 
<Button 
android:id="@+id/calculate_button" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:layout_alignParentTop="true" 
android:layout_alignParentRight="true" 
android:drawableTop="@drawable/calculate" 
android:text="Calculate" 
android:background="@android:color/transparent"> 
</Button> 
</RelativeLayout> 
</RelativeLayout> 
+0

Вы должны быть более точным. Какие размеры? И самое главное, каковы плотности экранов, на которых вы тестировали? – 2010-11-29 08:49:11

+0

Я просто добавил полный xml к сообщению ..! – 11Monkeys 2010-11-29 09:09:30

+0

Странно для меня, почему он будет масштабироваться, хотя вы используете для height wrap_content – Tima 2010-11-29 09:21:08

ответ

0

Хорошо, может быть, ваша проблема в вашем манифесте.

Поддержка всех экранов должны быть там

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

Другое дело заявил, SDK Api 4 должны быть объявлены в манифесте, а также. Маленькие экраны будут поддержаны первые из 1,6

<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="4"/> 

Надежда, я не так неправильно

0

Попробуйте явно указать android:padding для EditText и посмотреть, если это может помочь.

Смежные вопросы