4

In my android project I have xml file below:--

<LinearLayout 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" android:gravity="center_vertical|center_horizontal"
    android:orientation="vertical" android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin" tools:context=".LoginActivity"
    android:background="#ffBE80FF"
    android:descendantFocusability="beforeDescendants"
    android:focusableInTouchMode="true">

    <LinearLayout
        android:id="@+id/ll1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:gravity="center_vertical|center_horizontal">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:text="FOOBAR"
            android:id="@+id/textView2"
            android:textSize="30dp"
            android:textColor="#ffffffff" />


    </LinearLayout>

    <LinearLayout
        android:id="@+id/ll2"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:gravity="center_vertical|center_horizontal">
        <ProgressBar android:id="@+id/login_progress" style="?android:attr/progressBarStyleLarge"
            android:layout_width="wrap_content" android:layout_height="wrap_content"
            android:visibility="gone" />
        <ScrollView android:id="@+id/login_form" android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:fillViewport="true" >
            <LinearLayout android:layout_width="match_parent" 
                android:layout_height="wrap_content"
                android:orientation="vertical">

               <!--  <LinearLayout android:id="@+id/email_login_form"
                     android:layout_width="match_parent"
                    android:layout_height="wrap_content" android:orientation="vertical"> -->

                    <AutoCompleteTextView android:id="@+id/email" android:layout_width="match_parent"
                        android:layout_height="wrap_content" android:hint="@string/prompt_email"
                        android:inputType="textEmailAddress" android:maxLines="1"
                        android:singleLine="true"
                        android:layout_marginBottom="10dp"
                        android:textColorHint="#ffffffff"
                        android:textColor="#ffffffff" />

                    <EditText android:id="@+id/password" android:layout_width="match_parent"
                        android:layout_height="wrap_content" android:hint="@string/prompt_password"
                        android:imeActionLabel="@string/action_sign_in"
                        android:imeOptions="actionUnspecified" android:inputType="textPassword"
                        android:maxLines="1" android:singleLine="true"
                        android:layout_marginBottom="10dp"
                        android:textColorHint="#ffffffff"
                        android:textColor="#ffffffff" 
                          android:layout_weight="0.5"/>

                    <Button android:id="@+id/email_sign_in_button" style="?android:textAppearanceSmall"
                        android:layout_width="fill_parent"
                        
                         android:layout_height="wrap_content"
                        android:layout_marginTop="16dp" android:text="@string/action_sign_in"
                        android:textStyle="bold"
                        
                        android:textColor="#ffffffff"
                        android:background="#ff7e51c2" 
                          android:layout_weight="0.5"/>

                <!-- </LinearLayout> -->
            </LinearLayout>
        </ScrollView>
    </LinearLayout>

    <LinearLayout
        android:id="@+id/ll3"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:gravity="bottom|center_horizontal">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Sign up"
            android:id="@+id/signUpTextView"
            android:autoLink="web"
            android:textColor="#ffffffff" />
    </LinearLayout>
</LinearLayout>

Its displays properly what I need.It looks like below picture:-

enter image description here

But When I want to fill up the form.that time log-in button is not visible. its looks like below picture:-enter image description here

What am I doing wrong in my code?? Why it is not visible when i want to fill up the edit-text fields? please guys suggest me.

3
  • 1
    Why are you using ScrollView? Commented Nov 20, 2015 at 8:45
  • 1
    it is visible salini when you scroll it you find it below the edittext... Commented Nov 20, 2015 at 8:57
  • Try to use match_parent instead of fill_parent. Commented Nov 20, 2015 at 8:57

1 Answer 1

1

That is what you need:

<LinearLayout
    android:id="@+id/ll1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="1"
    android:gravity="center_vertical|center_horizontal">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:text="FOOBAR"
        android:id="@+id/textView2"
        android:textSize="30dp"
        android:textColor="#ffffffff" />


</LinearLayout>

<LinearLayout
    android:id="@+id/ll2"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center_vertical|center_horizontal">
    <ProgressBar android:id="@+id/login_progress" style="?android:attr/progressBarStyleLarge"
        android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:visibility="gone" />
    <ScrollView android:id="@+id/login_form" android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:fillViewport="true" >
        <LinearLayout android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <!--  <LinearLayout android:id="@+id/email_login_form"
                  android:layout_width="match_parent"
                 android:layout_height="wrap_content" android:orientation="vertical"> -->

            <AutoCompleteTextView android:id="@+id/email" android:layout_width="match_parent"
                android:layout_height="wrap_content" android:hint="@string/prompt_email"
                android:inputType="textEmailAddress" android:maxLines="1"
                android:singleLine="true"
                android:layout_marginBottom="10dp"
                android:textColorHint="#ffffffff"
                android:textColor="#ffffffff" />

            <EditText android:id="@+id/password" android:layout_width="match_parent"
                android:layout_height="wrap_content" android:hint="@string/prompt_password"
                android:imeActionLabel="@string/action_sign_in"
                android:imeOptions="actionUnspecified" android:inputType="textPassword"
                android:maxLines="1" android:singleLine="true"
                android:layout_marginBottom="10dp"
                android:textColorHint="#ffffffff"
                android:textColor="#ffffffff"
                android:layout_weight="0.5"/>

            <Button android:id="@+id/email_sign_in_button" style="?android:textAppearanceSmall"
                android:layout_width="fill_parent"

                android:layout_height="wrap_content"
                android:layout_marginTop="16dp" android:text="@string/action_sign_in"
                android:textStyle="bold"

                android:textColor="#ffffffff"
                android:background="#ff7e51c2"
                android:layout_weight="0.5"/>

            <!-- </LinearLayout> -->
        </LinearLayout>
    </ScrollView>
</LinearLayout>

<LinearLayout
    android:id="@+id/ll3"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="1"
    android:gravity="bottom|center_horizontal">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Sign up"
        android:id="@+id/signUpTextView"
        android:autoLink="web"
        android:textColor="#ffffffff" />
</LinearLayout>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.