简体   繁体   English

android scrollview不适用于cardView和noActionBar主题

[英]android scrollview not working with cardView and with noActionBar theme

Below xml contains a ScrollView and a Cardview but scrolling is not working for the ScrollView. xml下面包含ScrollView和Cardview,但是滚动不适用于ScrollView。 I have added below line in manifest for below layout: 我在清单中的以下行中添加了以下布局:

<activity android:windowSoftInputMode="adjustPan"
        android:name=".activities.RegisterActivity" />

Can anyone help me to fix this issue? 谁能帮我解决此问题?

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

使用android.support.v4.widget.NestedScrollView而不是ScrollView

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Theme.AppCompat.Light.NoActionBar.FullScreen不适用于Android 4.4 - Theme.AppCompat.Light.NoActionBar.FullScreen Not Working with Android 4.4 Scrollview不适用于Cardview - Scrollview Not working for Cardview ScrollView无法在CardView中运行 - ScrollView not working inside CardView Android Studio仍显示.noactionbar主题的标题 - Android studio still shows title on .noactionbar theme Android CardView 应用主题 - Android CardView apply Theme 为什么 Theme.AppCompat.NoActionBar 不隐藏操作栏而 android:Theme.Material.NoActionBar 会 - Why does Theme.AppCompat.NoActionBar not hide the action bar while android:Theme.Material.NoActionBar does 无法在当前主题CardView中找到样式&#39;cardview style&#39;在Android Studio 3.1.3中不起作用 - Failed to Find style 'cardview style ' in current theme CardView not working in Android Studio 3.1.3 Theme.AppCompat.Light.NoActionBar 在迁移到 androidx 后不起作用 - Theme.AppCompat.Light.NoActionBar not working after migrating to androidx Android Theme.AppCompat.Light.NoActionBar无法解析 - Android Theme.AppCompat.Light.NoActionBar can not be resolved 无法解析符号 Theme.MaterialComponents.Light.NoActionBar (Android Studio) - Cannot resolve symbol Theme.MaterialComponents.Light.NoActionBar (Android Studio)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM