Reputation: 1395
I have a problem that i hope you guys can help me out. I create a signup fragment that is called when user click 'create account' in activity page. But somehow in the fragment the scrollview seems not to be working. I can't scroll down. I have tried many suggestions from googling but it is still not working. I hope you can point out in my code what did i do wrong so i can fix it. Thank you in advance guys.
This is the activity that will call my fragment:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ActivityLoginSignupResetPassword"
android:animateLayoutChanges="true">
<FrameLayout
android:id="@+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true">
</FrameLayout>
</RelativeLayout>
This is my fragment where it supposed to be scrollable by user:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".FragmentSignup"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:focusableInTouchMode="true">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:isScrollContainer="false">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:id="@+id/textInputLayoutEmail"
android:hint="@string/email"
android:theme="@style/EditTextTheme">
<EditText
android:id="@+id/editTextEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:id="@+id/textInputLayoutPassword"
android:hint="@string/password"
app:passwordToggleEnabled="true"
android:theme="@style/EditTextTheme">
<EditText
android:id="@+id/editTextPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"/>
</android.support.design.widget.TextInputLayout>
<Button
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:id="@+id/buttonSignUp"
android:text="@string/signup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@drawable/btn_background_custom"
android:textColor="@drawable/btn_text_custom"
android:enabled="false"/>
</LinearLayout>
</ScrollView>
</RelativeLayout>
Upvotes: 1
Views: 2432
Reputation: 1395
After trying all your suggestions it still doesn't work. But after i add 'android:windowSoftInputMode="adjustResize|stateAlwaysVisible"' in my manifest file then it works great. Thank you.
Upvotes: 2
Reputation: 958
Try this:
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:isScrollContainer="false">
If you set the layout_height to wrap the content, then the scrollview itself will enlagre itself to fit the content. It therefore can't scroll because as far as the scrollview is concerned, it's displaying 100% of the content even if it is off screen.
Upvotes: 1