xml下面包含ScrollView和Cardview,但滚动对ScrollView不起作用。我已在清单中添加以下行以下布局:
<activity android:windowSoftInputMode="adjustPan"
android:name=".activities.RegisterActivity" />
有人可以帮我解决这个问题吗?
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/relative"
android:layout_width="match_parent"
android:layout_height="@dimen/margin_400dp"
android:layout_margin="@dimen/margin_10dp">
<android.support.v7.widget.CardView
android:id="@+id/cardview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible"
app:cardBackgroundColor="@color/white"
app:cardCornerRadius="@dimen/margin_5dp"
app:cardElevation="@dimen/margin_20dp"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="true">
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/margin_10dp"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="@dimen/margin_10dp"
android:src="@drawable/user_default" />
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_10dp"
android:textColorHint="@color/blue">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="@dimen/margin_50dp"
android:hint="@string/Email"
android:inputType="textEmailAddress"
android:textColor="@color/blue"
android:textColorHint="@color/blue"
android:theme="@style/MyEditTextTheme" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColorHint="@color/blue">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="@dimen/margin_50dp"
android:hint="@string/Name"
android:inputType="text"
android:textColor="@color/blue"
android:textColorHint="@color/blue"
android:theme="@style/MyEditTextTheme" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/Password"
android:textColorHint="@color/blue"
app:passwordToggleEnabled="true"
app:passwordToggleTint="@color/blue">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="@dimen/margin_50dp"
android:hint="@string/Password"
android:inputType="textPassword"
android:textColor="@color/blue"
android:textColorHint="@color/blue"
android:theme="@style/MyEditTextTheme" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>
<android.support.v7.widget.AppCompatButton
android:id="@+id/btn_signup"
android:layout_width="@dimen/margin_120dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@+id/relative"
android:layout_gravity="bottom|center"
android:layout_marginRight="@dimen/margin_60dp"
android:layout_marginTop="@dimen/margin_m65dp"
android:background="@drawable/rounded_textview"
android:gravity="center"
android:padding="@dimen/margin_10dp"
android:text="@string/Sign_up"
android:textColor="@color/white"
android:textSize="18sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/relative"
android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/margin_10dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/margin_10dp"
android:text="@string/already_have_an_account"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:padding="@dimen/margin_5dp"
android:text="@string/Login"
android:textColor="@color/blue"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
</ScrollView>
答案 0 :(得分:0)
使用android.support.v4.widget.NestedScrollView
代替ScrollView
。