android scrollview嵌套button,Android Scrollview in RelativeLayout with ButtonBar

在实现一个包含EditText、Logo和ButtonBar的登录界面时,遇到在小屏幕设备上显示不全的问题。当屏幕旋转或者尺寸过小时,整个主视图无法完全显示。尝试将内容放入ScrollView中,但导致了两个问题:一是ScrollView在某些情况下不滚动,二是ButtonBar会覆盖键盘,进一步遮挡屏幕。原本将按钮放在ScrollView内可以正常工作,但现在将它们移至ButtonBar后,如何解决这个问题成为一个挑战。

I'm trying to implement a login view where several EditTexts and a logo are displayed on the screen with a ButtonBar at the bottom, something like this:

The problem is that on very small screens, especially when they are rotated sideways, the entire main view doesn't fit onto the screen.

I currently have

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:background="#234C59" >

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:paddingTop="5dip"

android:paddingLeft="15dip"

android:paddingRight="15dip"

android:orientation="vertical" >

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

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

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

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

android:id="@+id/button_signup"

android:layout_width="0dip"

android:layout_height="wrap_content"

android:layout_weight="1"

android:text="Sign Up" />

android:id="@+id/button_login"

android:layout_width="0dip"

android:layout_height="wrap_content"

android:layout_weight="1"

android:text="Log In" />

I've tried encapsulating the first LinnearLayout in a ScrollView that looks like this:

android:layout_width="fill_parent"

android:layout_height="fill_parent">

But that introduces two problems:

The ScrollView doesn't scroll, even on screens where the data doesn't all fit

The ButtonBar floats on top of the onscreen keyboard, obscuring even more of the screen when the keyboard comes up.

Everything worked great when I had the buttons inside the ScrollView, but now that I have them in the ButtonBar I'm having a lot of trouble figuring this out.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值