【发布时间】:2015-10-03 08:21:53
【问题描述】:
我想制作包含三个EditTexts 和两个Buttons 的布局。但是当我创建布局并打开软键盘时,一些视图被隐藏了。而且我还使用了`ScrollView。
我的代码如下:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff">
<android.support.v7.widget.Toolbar
android:id="@+id/my_awesome_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_alignParentTop="true"
android:background="#FFFFFF">
<TextView
android:id="@+id/toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:ellipsize="end"
android:singleLine="true"
android:text="Sign Up"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold" />
</android.support.v7.widget.Toolbar>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/my_awesome_toolbar"
android:fillViewport="true"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:background="@drawable/code_selector"
android:gravity="center"
android:hint="Name"
android:padding="12dp"
android:singleLine="true"
android:textColor="#000000" />
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/name"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:background="@drawable/code_selector"
android:gravity="center"
android:hint="Password"
android:inputType="textPassword"
android:padding="12dp"
android:singleLine="true"
android:textColor="#000000" />
<EditText
android:id="@+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/password"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:background="@drawable/code_selector"
android:gravity="center"
android:hint="Email"
android:padding="12dp"
android:singleLine="true"
android:textColor="#000000" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_below="@id/email">
<com.facebook.login.widget.LoginButton
android:id="@+id/btnFacebookLogin"
style="@style/FacebookLoginButton"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
<TextView
android:id="@+id/textOr"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/btnFacebookLogin"
android:layout_margin="5dp"
android:gravity="center"
android:text="Or"
android:textStyle="bold|italic" />
<Button
android:id="@+id/btnNext"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_above="@+id/textOr"
android:layout_centerHorizontal="true"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:background="#AA008000"
android:text="Next"
android:textAllCaps="false"
android:textColor="#ffffff" />
</RelativeLayout>
</RelativeLayout>
</ScrollView>
请帮我解决这个问题。谢谢。
【问题讨论】:
-
如果你使用的是
ToolBar,你不能给出这样的标题 -
但我想设置标题中心
-
你还有什么方法吗?
标签: android android-layout android-relativelayout