I have three EditText in my layout. When i click on any of them then it shrinks my layout and the second layout is barely visible. I want that when i click on second layout ("Dear Parents"), keyboard should overlap the last edittext (teachers name) and when i click on last edittext then it should appear above keyboard.
Here are the screenshots
and here is the code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/actionbar_title_color"
android:orientation="vertical">
<include
android:id="#+id/include"
layout="#layout/toolbar" />
<android.support.v7.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:layout_marginTop="25dp"
card_view:cardElevation="10sp"
card_view:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:background="#drawable/filebinder" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="14"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="10dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="6"
android:orientation="vertical">
<TextView
android:id="#+id/dateDiary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:fontFamily="sans-serif"
android:text="30 July"
android:textColor="#03a9f4"
android:textSize="20sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginBottom="10dp"
android:background="#03a9f4" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/diarybookmark" />
</LinearLayout>
<ScrollView
android:id="#+id/scrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp">
<EditText
android:id="#+id/diaryHeading"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:ems="5"
android:fontFamily="sans-serif"
android:hint="Diary Heading"
android:inputType="textPersonName"
android:textAlignment="center"
android:textColor="#000000"
android:textSize="18sp" />
</ScrollView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<EditText
android:id="#+id/diaryTeacherName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="center"
android:fontFamily="sans-serif"
android:hint="Teacher\'s Name..."
android:textSize="16sp" />
<at.markushi.ui.CircleButton
android:id="#+id/addDiaryEntry"
android:layout_width="74dip"
android:layout_height="74dip"
android:layout_gravity="right"
android:src="#drawable/ic_action_tick"
app:cb_color="#color/actionbar_title_color"
app:cb_pressedRingWidth="8dip"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<EditText
android:id="#+id/diaryContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/addDiaryEntry"
android:layout_alignLeft="#+id/scrollView"
android:layout_alignStart="#+id/scrollView"
android:layout_alignTop="#+id/scrollView"
android:fontFamily="sans-serif"
android:gravity="top"
android:hint="Enter Diary Note...\n\n\n\n"
android:text="Dear Parents,"
android:textSize="14sp" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
and here is my manifest
<activity
android:name=".DiaryEntry.DiaryEntryTeacherActivity"
android:label="DiaryEntry"
android:windowSoftInputMode="adjustResize"
android:theme="#style/AppTheme.NoActionBar"></activity>
You need to use ScrollView as;
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/actionbar_title_color"
android:orientation="vertical">
<include
android:id="#+id/include"
layout="#layout/toolbar" />
<ScrollView
android:id="#+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<android.support.v7.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:layout_marginTop="25dp"
card_view:cardElevation="10sp"
card_view:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:background="#drawable/filebinder" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="14"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="10dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="6"
android:orientation="vertical">
<TextView
android:id="#+id/dateDiary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:fontFamily="sans-serif"
android:text="30 July"
android:textColor="#03a9f4"
android:textSize="20sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginBottom="10dp"
android:background="#03a9f4" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/diarybookmark" />
</LinearLayout>
<ScrollView
android:id="#+id/scrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp">
<EditText
android:id="#+id/diaryHeading"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:ems="5"
android:fontFamily="sans-serif"
android:hint="Diary Heading"
android:inputType="textPersonName"
android:textAlignment="center"
android:textColor="#000000"
android:textSize="18sp" />
</ScrollView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<EditText
android:id="#+id/diaryTeacherName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="center"
android:fontFamily="sans-serif"
android:hint="Teacher\'s Name..."
android:textSize="16sp" />
<at.markushi.ui.CircleButton
android:id="#+id/addDiaryEntry"
android:layout_width="74dip"
android:layout_height="74dip"
android:layout_gravity="right"
android:src="#drawable/ic_action_tick"
app:cb_color="#color/actionbar_title_color"
app:cb_pressedRingWidth="8dip"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<EditText
android:id="#+id/diaryContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/addDiaryEntry"
android:layout_alignLeft="#+id/scrollView"
android:layout_alignStart="#+id/scrollView"
android:layout_alignTop="#+id/scrollView"
android:fontFamily="sans-serif"
android:gravity="top"
android:hint="Enter Diary Note...\n\n\n\n"
android:text="Dear Parents,"
android:textSize="14sp" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</ScrollView>
</LinearLayout>
Related
I have been trying to use RelativeLayout in ScrollView to positioning two LinearLayouts, one to top and one to center. I've used layout_alignParentTop and layout_centerVertical. To prevent overlapping I've tried to use layout_below on second LinearLayout but it breaks layout_centerVertical and the second LinearLayout goes to top. How to do it? Thanks.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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:fillViewport="true"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".activities.StartFragment">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="#+id/trial_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="25dp"
android:layout_alignParentTop="true"
android:background="#drawable/trial_border"
android:foreground="?android:attr/selectableItemBackground"
android:clickable="true"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_gravity="top"
android:layout_marginRight="10dp"
android:layout_marginTop="3dp"
android:layout_marginLeft="10dp"
android:src="#drawable/ic_access_time_black_24dp" />
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:orientation="vertical">
<TextView
android:id="#+id/trial_text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="left|center"
android:text="#string/trial_exp"
android:textColor="#color/darkGrey"
android:textSize="15sp" />
<TextView
android:id="#+id/trial_more"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="right|center"
android:text="#string/trial_exp_more"
android:textColor="#color/darkGreen"
android:layout_marginRight="10dp"
android:textSize="13sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/main_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/trial_button"
android:layout_centerVertical="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="top"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="#+id/VImage"
android:layout_width="wrap_content"
android:layout_height="200sp"
android:src="#drawable/image_global" />
<TextView
android:id="#+id/VText"
android:layout_width="match_parent"
android:layout_height="40dp"
android:gravity="center"
android:text="#string/protection_disabled"
android:textColor="#color/darkRed"
android:textSize="18sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="top"
android:gravity="center"
android:orientation="vertical">
<com.google.android.material.button.MaterialButton
android:id="#+id/start_vpn_button"
style="#style/Widget.AppCompat.Button.Borderless.Colored"
android:layout_width="141dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="#string/protect_me"
android:textColor="#color/white"
android:textStyle="bold"
app:backgroundTint="#color/green" />
<com.google.android.material.button.MaterialButton
android:id="#+id/stop_vpn_button"
style="#style/Widget.AppCompat.Button.Borderless.Colored"
android:layout_width="141dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="#string/unprotect_me"
android:textColor="#color/white"
android:textStyle="bold"
android:visibility="gone"
app:backgroundTint="#color/red" />
</LinearLayout>
<LinearLayout
android:id="#+id/r_button"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="50sp"
android:layout_marginRight="20dp"
android:background="#drawable/single_border"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground"
android:orientation="horizontal">
<ImageView
android:id="#+id/r_image"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_gravity="center"
android:src="#drawable/image_r_50" />
<TextView
android:id="#+id/r_text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="left|center"
android:text="#string/r_to"
android:textColor="#color/darkGrey"
android:textSize="15sp" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</ScrollView>
I have already with adjustresize and adjustpan also but nothing worked for me here.
Here is my xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:background="#color/gray"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="9">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="150dp"
android:id="#+id/relativeLayout2">
<ImageView
android:layout_width="match_parent"
android:src="#drawable/backgroiund"
android:scaleType="fitXY"
android:layout_height="match_parent" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_height="500dp"
android:background="#FFFFFF"
android:id="#+id/relativeLayout"
android:orientation="vertical"
android:layout_marginTop="120dp"
android:layout_centerHorizontal="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="65dp">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="120dp">
<TextView
android:layout_width="match_parent"
android:text="Srinivas"
android:id="#+id/user_name"
android:textSize="25sp"
android:gravity="center"
android:layout_height="wrap_content" />
<TextView
android:layout_width="match_parent"
android:text="Android Developer"
android:textSize="18sp"
android:layout_marginTop="10dp"
android:gravity="center"
android:layout_height="wrap_content" />
<TextView
android:layout_width="match_parent"
android:text="Tadepalligudem,West Godavari"
android:layout_marginTop="10dp"
android:gravity="center"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:background="#drawable/boarder"
android:layout_marginLeft="20dp"
android:layout_gravity="center"
android:layout_marginRight="20dp"
android:layout_height="40dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:textSize="18sp"
android:text="about"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="5dp"
android:layout_marginTop="10dp"
android:background="#dfdfdf"/>
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_height="100dp">
<TextView
android:layout_width="match_parent"
android:text="Intrests"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:textSize="20sp"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="#A9A9A9"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_gravity="center"
android:gravity="center"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="#drawable/bg1"
android:layout_weight="8.5">
<ImageView
android:id="#+id/editsearch"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="18dp"
android:layout_gravity="center"
android:foregroundGravity="center"
android:src="#drawable/search" />
<EditText
android:id="#+id/name"
android:layout_width="0dp"
android:layout_weight="9"
android:layout_height="wrap_content"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:backgroundTint="#00000000"
android:inputType="textCapSentences"
android:hint="Search Intrests"
android:singleLine="true"
android:layout_gravity="center"
android:background="#null"
android:padding="2dp"
android:textColorHint="#9B9B9B"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:id="#+id/buton_layout"
android:orientation="vertical"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="#drawable/boarder">
<ScrollView
android:id="#+id/scroll"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.buzzed.utils.FlowLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/flow_container1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="10dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="10dp"
android:gravity="center"
android:paddingBottom="10dp"
app:elementSpacing="5dp"
app:flowDirection="leftToRight"
app:lineSpacing="14dp" />
</ScrollView>
</LinearLayout>
<LinearLayout
android:layout_height="80dp"
android:layout_width="match_parent">
<Button
android:layout_width="match_parent"
android:background="#drawable/circlecorner1"
android:text="save"
android:textSize="18sp"
android:layout_marginTop="10dp"
android:id="#+id/save"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:onClick="save"
android:layout_gravity="top"
android:textColor="#color/White"
android:layout_height="40dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:id="#+id/list_layout"
android:orientation="vertical"
android:visibility="gone"
android:layout_height="match_parent">
<ListView
android:id="#+id/listview"
android:layout_width="match_parent"
android:layout_height="match_parent"></ListView>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/user_pic"
android:layout_width="140dp"
android:layout_height="140dp"
android:layout_gravity="center"
android:src="#drawable/grey_round"
android:layout_marginTop="37dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
</ScrollView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="#FFFFFF"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_weight="1">
</LinearLayout>
</LinearLayout>
When I used AdjustPan nothing happened but when I tried with AdjustResize the screen is scrollable and I can move it manually but what I need is to move screen automatically when keyboard open and yes it is happening in fragment. Please help me .
My XML is too slow, and I already found other's example but it didn't help mine.
See My XML:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
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:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:windowSoftInputMode="adjustResize">
<!--Preview Card-->
<android.support.v7.widget.CardView
android:id="#+id/preview"
android:layout_width="380dp"
android:layout_height="213.75dp"
android:background="#drawable/ic_ending"
android:layout_marginTop="20dp"
android:layout_centerHorizontal="true">
<ImageView
android:id="#+id/preview_bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="#drawable/bg_1" />
<ImageView
android:id="#+id/preview_black"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="0.3"
android:src="#000000" />
<TextView
android:id="#+id/preview_text1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:gravity="center"
android:text="#string/input_text"
android:textColor="#FFFFFF"
android:textAlignment="center"
android:textSize="20sp" />
</android.support.v7.widget.CardView>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!--Empty Card-->
<android.support.v7.widget.CardView
android:id="#+id/preview_empty"
android:layout_width="380dp"
android:layout_height="213.75dp"
android:background="#drawable/ic_ending"
android:layout_marginTop="20dp"
android:layout_centerHorizontal="true">
</android.support.v7.widget.CardView>
<!--Menu_1 Card-->
<android.support.v7.widget.CardView
android:id="#+id/menu_1"
android:layout_width="380dp"
android:layout_height="wrap_content"
android:background="#drawable/ic_ending"
android:layout_below="#+id/preview_empty"
android:layout_marginTop="20dp"
android:layout_centerHorizontal="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!--Text Font-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/text_font"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/usual_margin"
android:layout_marginLeft="#dimen/usual_margin"
android:text="#string/text_font"
android:textStyle="bold"
android:textSize="16sp"/>
<Spinner
android:id="#+id/dropdown_font"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/usual_margin"
android:layout_marginRight="#dimen/usual_margin"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="#+id/colortext"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/usual_margin"
android:layout_marginLeft="#dimen/usual_margin"
android:layout_marginBottom="#dimen/usual_margin"
android:layout_weight="1"
app:srcCompat="#drawable/ic_format_color_text"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground"/>
<ImageView
android:id="#+id/boldtext"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/usual_margin"
android:layout_marginLeft="#dimen/usual_margin"
android:layout_marginBottom="#dimen/usual_margin"
android:layout_weight="1"
app:srcCompat="#drawable/ic_format_bold"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground" />
<ImageView
android:id="#+id/italictext"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/usual_margin"
android:layout_marginLeft="#dimen/usual_margin"
android:layout_marginBottom="#dimen/usual_margin"
android:layout_weight="1"
app:srcCompat="#drawable/ic_format_italic"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground"/>
</LinearLayout>
</LinearLayout>
<!--Text Size-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/text_size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/usual_margin"
android:layout_marginLeft="#dimen/usual_margin"
android:text="#string/text_size"
android:textStyle="bold"
android:textSize="16sp"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="#dimen/usual_margin">
<SeekBar
android:id="#+id/textsize_sb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toStartOf="#+id/textsize_edit"
android:layout_centerInParent="true"
android:progress="20"
android:max="99"/>
<EditText
android:id="#+id/textsize_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="16dp"
android:ems="2"
android:maxLength="2"
android:text="20"
android:textAlignment="center"
android:inputType="number" />
</RelativeLayout>
</LinearLayout>
<!--Input Text-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/input_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/usual_margin"
android:text="#string/input_text"
android:textStyle="bold"
android:textSize="16sp"/>
<EditText
android:id="#+id/inputtext_edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/usual_margin"
android:layout_marginRight="#dimen/usual_margin"
android:layout_marginBottom="#dimen/usual_margin"
android:ems="10"
android:inputType="text|textMultiLine|textCapSentences"
android:text="#string/input_text" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<!--Menu_2 Card-->
<android.support.v7.widget.CardView
android:id="#+id/menu_2"
android:layout_width="380dp"
android:layout_height="wrap_content"
android:background="#drawable/ic_ending"
android:layout_below="#+id/menu_1"
android:layout_marginTop="20dp"
android:layout_marginBottom= "80dp"
android:layout_centerHorizontal="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!--Outer_Glow-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/text_glow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/usual_margin"
android:layout_marginLeft="#dimen/usual_margin"
android:text="#string/outer_glow"
android:textStyle="bold"
android:shadowRadius="20"
android:shadowColor="#color/colorWhite"
android:shadowDx="0"
android:shadowDy="0"
android:textSize="16sp"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="#dimen/usual_margin">
<SeekBar
android:id="#+id/glow_sb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toStartOf="#+id/glow_edit"
android:layout_centerInParent="true"
android:progress="20"
android:max="99"/>
<EditText
android:id="#+id/glow_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="16dp"
android:ems="2"
android:maxLength="2"
android:text="20"
android:textAlignment="center"
android:inputType="number" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>
</ScrollView>
<!--Preview Guideline -->
<ImageView
android:layout_width="match_parent"
android:layout_height="253.75dp"
android:src="#FAFAFA"/>
<!--Save Button-->
<android.support.design.widget.FloatingActionButton
android:id="#+id/saveexp"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="#dimen/usual_margin"
android:layout_marginRight="#dimen/usual_margin"
android:clickable="true"
android:src="#drawable/ic_save"
android:tint="#FFFFFF"
app:fabSize="normal"/>
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>
That's it, and even it's hard to scroll it.
I already check java code, but it's not slow, but when I check xml code in temp app without java code, it is hard to scroll.
Is this structure bad?
Or why is it too slow...
What can I do? Thanks for your answering.
In my login page I have two LinearLayouts. The second Linear-layout I want to set at center of it's Parent Relative layout and another Linear layout I want to be set top|left of it's parent Relative- layout.
How can I achieve this?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/rootLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/yellow">
<ScrollView
android:id="#+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="false">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:gravity="top"
android:layout_alignParentLeft="true"
android:orientation="vertical">
<TextView
android:id="#+id/user_name_text_view_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:text="#string/language_title"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/redcolor" />
<Spinner
android:id="#+id/spinnerList"
style="#style/spinner_style"
android:layout_width="85dp"
android:layout_height="wrap_content"
android:layout_marginTop="3dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="25dp"
android:src="#drawable/ic_serba_logo_red" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/textmain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_margin="10dp"
android:orientation="vertical">
<EditText
android:id="#+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="#drawable/bordertextbox"
android:ems="10"
android:hint="#string/username_title"
android:inputType="textEmailAddress"
android:padding="8dp"
android:textColor="#android:color/white"
android:textColorHint="#android:color/white">
<requestFocus />
</EditText>
<EditText
android:id="#+id/editText2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="7dp"
android:background="#drawable/bordertextbox"
android:ems="10"
android:hint="#string/password_title"
android:inputType="textPassword"
android:padding="8dp"
android:textColor="#android:color/white"
android:textColorHint="#android:color/white" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:weightSum="2">
<Button
android:id="#+id/registerButton"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginRight="7dp"
android:layout_weight="1"
android:background="#color/splahbgcolor"
android:text="#string/user_register_title"
android:textColor="#android:color/white" />
<Button
android:id="#+id/loginButton"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="7dp"
android:layout_weight="1"
android:background="#color/splahbgcolor"
android:text="#string/user_login__title"
android:textColor="#android:color/white" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
You just need to change 2 things :
android:fillViewport="true" //for scrollView
and for your RelativeLayout height should be match_parent
android:layout_height="match_parent"
use android:layout_centerInParent="true" for LinearLayout when its parent is Relative layout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/rootLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/yellow">
<ScrollView
android:id="#+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="false">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:gravity="top"
android:layout_alignParentLeft="true"
android:orientation="vertical">
<TextView
android:id="#+id/user_name_text_view_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:text="#string/language_title"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/redcolor" />
<Spinner
android:id="#+id/spinnerList"
style="#style/spinner_style"
android:layout_width="85dp"
android:layout_height="wrap_content"
android:layout_marginTop="3dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="25dp"
android:src="#drawable/ic_serba_logo_red" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/textmain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_margin="10dp"
android:orientation="vertical">
<EditText
android:id="#+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="#drawable/bordertextbox"
android:ems="10"
android:hint="#string/username_title"
android:inputType="textEmailAddress"
android:padding="8dp"
android:textColor="#android:color/white"
android:textColorHint="#android:color/white">
<requestFocus />
</EditText>
<EditText
android:id="#+id/editText2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="7dp"
android:background="#drawable/bordertextbox"
android:ems="10"
android:hint="#string/password_title"
android:inputType="textPassword"
android:padding="8dp"
android:textColor="#android:color/white"
android:textColorHint="#android:color/white" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:weightSum="2">
<Button
android:id="#+id/registerButton"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginRight="7dp"
android:layout_weight="1"
android:background="#color/splahbgcolor"
android:text="#string/user_register_title"
android:textColor="#android:color/white" />
<Button
android:id="#+id/loginButton"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="7dp"
android:layout_weight="1"
android:background="#color/splahbgcolor"
android:text="#string/user_login__title"
android:textColor="#android:color/white" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
I have Change your code Just try it. i think its work well
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/rootLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/background_light">
<ScrollView
android:id="#+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:gravity="top"
android:layout_alignParentLeft="true"
android:orientation="vertical">
<TextView
android:id="#+id/user_name_text_view_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:text="title"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#android:color/holo_red_dark" />
<Spinner>
android:id="#+id/spinnerList"
style="#"
android:layout_width="85dp"
android:layout_height="wrap_content"
android:layout_marginTop="3dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:src="#mipmap/ic_launcher" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/textmain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_margin="10dp"
android:orientation="vertical">
<EditText
android:id="#+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="#android:color/holo_blue_light"
android:ems="10"
android:hint="username"
android:inputType="textEmailAddress"
android:padding="8dp"
android:textColor="#android:color/white"
android:textColorHint="#android:color/white">
<requestFocus />
</EditText>
<EditText
android:id="#+id/editText2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="7dp"
android:background="#android:color/holo_blue_light"
android:ems="10"
android:hint="password"
android:inputType="textPassword"
android:padding="8dp"
android:textColor="#android:color/white"
android:textColorHint="#android:color/white" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:weightSum="2">
<Button
android:id="#+id/registerButton"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginRight="7dp"
android:layout_weight="1"
android:background="#color/BlueColor"
android:text="register"
android:textColor="#android:color/white" />
<Button
android:id="#+id/loginButton"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="7dp"
android:layout_weight="1"
android:background="#1FFBBD"
android:text="Login"
android:textColor="#android:color/white" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</ScrollView>
I have a scroll view containing one child layout(linear layout) and that child contains a relative layout and a linear layout. Relative layout and linear layout shares half-half screen. Linear layout has buttons added to it dynamically.
Now problem arises as scroll view does not scroll buttons while it scrolls relative layout and linear layout.
<ScrollView>
<LinearLayout>
<RelativeLayout>
</RelativeLayout>
<LinearLayout>
->Dynamically adding buttons here
</LinearLayout>
</LinearLayout>
</ScrollView>
I want those buttons scroll with scrollview
For reference my xml code is :-
<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:background="#color/whitecolor"
android:orientation="vertical"
>
<ScrollView
android:id="#+id/scrollview"
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"
>
<RelativeLayout
android:
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical"
>
<View
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/bluecolor"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/stauslinearlayout"
android:layout_marginBottom="8dp"
android:padding="5dp"
android:gravity="center"
android:textColor="#color/whitecolor"
android:text="#string/app_name"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:background="#color/bluecolor"
>
<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/edit_text_custom"
android:singleLine="true"
android:hint="#string/status"
android:textColor="#000"
android:textColorHint="#5222"
android:padding="7dp"
android:maxLength="50"
android:cursorVisible="true"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:drawableLeft="#android:drawable/ic_input_add"
android:ems="10"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="right|center_horizontal"
android:gravity="center"
android:layout_weight="0"
android:layout_marginBottom="10dp"
android:layout_marginRight="10dp"
android:padding="5dp"
android:text="#string/statusnumber"
android:background="#drawable/edit_text_custom"
/>
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/whitecolor"
android:text="abcdfrg"
/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/app_name"
/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/app_name"
/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/app_name"
/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/app_name"
/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/app_name"
/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/app_name"
/>
</LinearLayout>
</LinearLayout>
</ScrollView>
AFAIK, If you want to divide screen in to same two sizes, you have to take another scrollView in bottom view, like below example...
<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:orientation="vertical" >
<ScrollView
android:id="#+id/scrollview"
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" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical" >
<View
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/darker_gray" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/stauslinearlayout"
android:layout_marginBottom="8dp"
android:gravity="center"
android:padding="5dp"
android:text="#string/app_name"
android:textColor="#android:color/white" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#android:color/darker_gray"
android:orientation="horizontal" >
<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:cursorVisible="true"
android:drawableLeft="#android:drawable/ic_input_add"
android:ems="10"
android:hint="status"
android:maxLength="50"
android:padding="7dp"
android:singleLine="true"
android:textColor="#000"
android:textColorHint="#5222" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="right|center_horizontal"
android:layout_marginBottom="10dp"
android:layout_marginRight="10dp"
android:layout_weight="0"
android:gravity="center"
android:padding="5dp"
android:text="statusnumber" />
</LinearLayout>
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/white"
android:text="abcdfrg" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/app_name" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/app_name" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/app_name" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/app_name" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/app_name" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/app_name" />
</LinearLayout>
</ScrollView>
</LinearLayout>
</ScrollView>
</LinearLayout>
and if you don't want to take another scrollView, then you have to give wrap_contant to bottom linear-layout.
<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:orientation="vertical" >
<ScrollView
android:id="#+id/scrollview"
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" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical" >
<View
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/darker_gray" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/stauslinearlayout"
android:layout_marginBottom="8dp"
android:gravity="center"
android:padding="5dp"
android:text="#string/app_name"
android:textColor="#android:color/white" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#android:color/darker_gray"
android:orientation="horizontal" >
<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:cursorVisible="true"
android:drawableLeft="#android:drawable/ic_input_add"
android:ems="10"
android:hint="status"
android:maxLength="50"
android:padding="7dp"
android:singleLine="true"
android:textColor="#000"
android:textColorHint="#5222" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="right|center_horizontal"
android:layout_marginBottom="10dp"
android:layout_marginRight="10dp"
android:layout_weight="0"
android:gravity="center"
android:padding="5dp"
android:text="statusnumber" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/white"
android:text="abcdfrg" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/app_name" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/app_name" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/app_name" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/app_name" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/app_name" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/app_name" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
choice goes to your requirement.
if any problem yet, then plz ask... :-)