Tôi đang cố gắng để thực hiện một cái nhìn login nơi nhiều EditTexts và một logo được hiển thị trên màn hình với một ButtonBar ở phía dưới, một cái gì đó như thế này:Android scrollview trong RelativeLayout với ButtonBar
alt text http://russellhaering.com/media/addAccount.png
Các vấn đề là trên màn hình rất nhỏ, đặc biệt là khi chúng được xoay ngang, toàn bộ khung nhìn chính không vừa với màn hình.
Tôi hiện đang có
<?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>
tôi đã cố gắng đóng gói LinnearLayout đầu tiên trong một scrollview trông như thế này:
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!-- Linear Layout Here -->
</ScrollView>
Nhưng đó giới thiệu hai vấn đề:
ScrollView không cuộn, ngay cả trên màn hình nơi dữ liệu không phù hợp với
Nút ButtonBar nổi trên đầu bàn phím ảo, che khuất màn hình nhiều hơn khi bàn phím xuất hiện.
Mọi thứ hoạt động tốt khi tôi có các nút bên trong ScrollView, nhưng bây giờ tôi đã có chúng trong ButtonBar, tôi đang gặp nhiều khó khăn trong việc tìm hiểu điều này.
Thật không may, tôi cần giữ thanh nút ở chế độ ngang, vì bạn cần thanh để gửi biểu mẫu (và tôi không muốn ai đó trên G1 hoặc bất cứ thứ gì phải đóng bàn phím và xoay điện thoại để gửi). Tin vui là đề xuất của bạn liên quan đến android: windowSoftInputMode = "adjustResize" đưa tôi đi đúng hướng và tôi có thể làm việc đó. Tôi sẽ đăng câu trả lời của tôi trong giây lát. Cảm ơn sự giúp đỡ! –