Я пытаюсь реализовать вид входа в систему, где на экране отображаются несколько EditTexts и логотип с ButtonBar внизу, что-то вроде этого:
alt text http://russellhaering.com/media/addAccount.png
Проблема в том, что на очень маленьких экранах, особенно когда они повернуты вбок, весь основной вид не помещается на экран.
В настоящее время у меня есть
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#234C59" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingTop="5dip"
android:paddingLeft="15dip"
android:paddingRight="15dip"
android:orientation="vertical" >
<ImageView
android:id="@+id/logo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scaleType="fitCenter"
android:layout_centerHorizontal="true"
android:src="@drawable/logo" />
<EditText
android:id="@+id/input_email"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:inputType="textEmailAddress"
android:singleLine="true"
android:hint="Username or email" />
<EditText
android:id="@+id/input_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop=""
android:inputType="textPassword"
android:singleLine="true"
android:hint="Password" />
</LinearLayout>
<LinearLayout
android:id="@+id/buttonbar_login"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
style="@android:style/ButtonBar" >
<Button
android:id="@+id/button_signup"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Sign Up" />
<Button
android:id="@+id/button_login"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Log In" />
</LinearLayout>
</RelativeLayout>
У меня естьпопытался инкапсулировать первый LinnearLayout в ScrollView, который выглядит следующим образом:
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!-- Linear Layout Here -->
</ScrollView>
Но возникает две проблемы:
ScrollView не прокручивается даже на экранахгде данные не все помещаются
Панель кнопок плавает в верхней части экранной клавиатуры, скрывая еще больше экрана, когда клавиатура появляется.
Все работало отлично, когда у меня были кнопки внутри ScrollView, но теперь, когда они у меня есть в ButtonBar, у меня возникли большие проблемы с этим разобраться.