I'm new in Android development. I got issue of nested ScrollView. There are three RecyclerViews inside nested ScrollView. There is only one parent Linearlayout inside my nested scrollview. I also make nestedscrollEnbaled=false. Then also I'm unable to achieve smooth scrolling. Please help me to solve my problem.
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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=".fragments.HomeFragment">
<com.facebook.shimmer.ShimmerFrameLayout
android:id="#+id/shimmer_view_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dp">
<include layout="#layout/shimmer_dashboard" />
</LinearLayout>
</com.facebook.shimmer.ShimmerFrameLayout>
<RelativeLayout
android:id="#+id/RelativeInternetNotAvailable"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:src="#drawable/network_unavailability">
</ImageView>
</RelativeLayout>
<android.support.v4.widget.SwipeRefreshLayout
android:id="#+id/simpleSwipeRefreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="#+id/relativeLayoutParent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<android.support.v4.view.ViewPager
android:id="#+id/viewflipper"
android:layout_width="wrap_content"
android:layout_height="#dimen/_180sdp"
android:layout_marginTop="#dimen/_70sdp"
android:autoStart="true"
android:flipInterval="2000">
</android.support.v4.view.ViewPager>
<me.relex.circleindicator.CircleIndicator
android:id="#+id/indicator"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="#dimen/_230sdp" />
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/relativevegetables"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/card_view"
android:layout_margin="#dimen/_5sdp">
<TextView
android:id="#+id/txtHomeCategories"
android:layout_width="match_parent"
android:layout_height="#dimen/_25sdp"
android:background="#color/faintskin"
android:fontFamily="serif"
android:gravity="center"
android:padding="#dimen/_5sdp"
android:text="Home Categories"
android:textColor="#color/whiteTextColor"
android:textSize="#dimen/_12sdp"
android:textStyle="bold" />
<ImageView
android:id="#+id/imgvegetables"
android:layout_width="#dimen/_102sdp"
android:layout_height="#dimen/_105sdp"
android:layout_below="#id/txtHomeCategories"
android:layout_marginTop="#dimen/_10sdp"
android:scaleType="fitXY"
android:src="#drawable/home_categories_vegetables" />
<ImageView
android:id="#+id/imgfruitdash"
android:layout_width="#dimen/_102sdp"
android:layout_height="#dimen/_105sdp"
android:layout_below="#id/txtHomeCategories"
android:layout_marginTop="#dimen/_10sdp"
android:layout_toRightOf="#id/imgvegetables"
android:scaleType="fitXY"
android:src="#drawable/home_categories_fruits"
/>
<ImageView
android:id="#+id/imgfruitda"
android:layout_width="#dimen/_102sdp"
android:layout_height="#dimen/_105sdp"
android:layout_below="#id/txtHomeCategories"
android:layout_marginTop="#dimen/_10sdp"
android:layout_toRightOf="#id/imgfruitdash"
android:scaleType="fitXY"
android:src="#drawable/home_categories_dairy" />
<ImageView
android:id="#+id/imgsprouts"
android:layout_width="#dimen/_102sdp"
android:layout_height="#dimen/_105sdp"
android:layout_below="#id/imgvegetables"
android:scaleType="fitXY"
android:src="#drawable/home_categories_sprouts" />
<ImageView
android:id="#+id/imgexoticfruits"
android:layout_width="#dimen/_102sdp"
android:layout_height="#dimen/_105sdp"
android:layout_below="#id/imgfruitdash"
android:layout_toRightOf="#id/imgsprouts"
android:scaleType="fitXY"
android:src="#drawable/home_categories_exotic_fruits"
/>
<ImageView
android:id="#+id/imgexoticveggies"
android:layout_width="#dimen/_102sdp"
android:layout_height="#dimen/_105sdp"
android:layout_below="#id/imgfruitda"
android:layout_toRightOf="#id/imgexoticfruits"
android:scaleType="fitXY"
android:src="#drawable/home_categories_exotic_veggies" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/relativevegetables"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_5sdp"
android:orientation="vertical">
<TextView
android:id="#+id/txtfeatureproducts"
android:layout_width="match_parent"
android:layout_height="#dimen/_25sdp"
android:layout_marginLeft="#dimen/_5sdp"
android:layout_marginTop="#dimen/_5sdp"
android:layout_marginRight="#dimen/_5sdp"
android:background="#color/faintskin"
android:fontFamily="serif"
android:gravity="center"
android:padding="#dimen/_5sdp"
android:text="Feature Products"
android:textColor="#color/whiteTextColor"
android:textSize="#dimen/_12sdp"
android:textStyle="bold" />
<android.support.v7.widget.RecyclerView
android:id="#+id/featureRecycler"
class="android.support.v7.widget.RecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="#dimen/_10sdp"
android:background="#color/profileAccentColor"
android:divider="#ad5"
android:nestedScrollingEnabled="false"
android:isScrollContainer="false"
android:dividerHeight="2dp" />
<android.support.v4.widget.ContentLoadingProgressBar
android:layout_width="match_parent"
android:layout_height="wrap_content">
</android.support.v4.widget.ContentLoadingProgressBar>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_5sdp"
android:orientation="vertical">
<TextView
android:id="#+id/txtfreshfarmproducts"
android:layout_width="match_parent"
android:layout_height="#dimen/_25sdp"
android:layout_marginLeft="#dimen/_5sdp"
android:layout_marginTop="#dimen/_5sdp"
android:layout_marginRight="#dimen/_5sdp"
android:background="#color/faintskin"
android:fontFamily="serif"
android:gravity="center"
android:padding="#dimen/_5sdp"
android:text="Shreenath Vegetables Products"
android:textColor="#color/whiteTextColor"
android:textSize="#dimen/_12sdp"
android:textStyle="bold" />
<android.support.v4.widget.ContentLoadingProgressBar
android:layout_width="match_parent"
android:layout_height="wrap_content">
</android.support.v4.widget.ContentLoadingProgressBar>
<android.support.v7.widget.RecyclerView
android:id="#+id/searchRecycler"
class="android.support.v7.widget.RecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="#dimen/_10sdp"
android:background="#color/profileAccentColor"
android:divider="#ad5"
android:nestedScrollingEnabled="false"
android:isScrollContainer="false"
android:dividerHeight="2dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="match_parent"
android:layout_height="#dimen/_50sdp"
android:width="#dimen/_50sdp"
android:background="#f7f7f7" />
</LinearLayout>
</LinearLayout>
<android.support.v7.widget.CardView
android:id="#+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/viewflipper"
android:layout_alignParentTop="true"
android:layout_marginLeft="5dp"
android:layout_marginTop="#dimen/_240sdp"
android:layout_marginRight="5dp"
android:layout_marginBottom="#dimen/_5sdp"
android:visibility="gone"
app:cardCornerRadius="#dimen/_10sdp"
app:contentPadding="5dp">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:drawableLeft="#drawable/bike"
android:drawablePadding="#dimen/_5sdp"
android:fontFamily="serif"
android:gravity="center"
android:text="MORNING : "
android:textColor="#color/darkgrey"
android:textStyle="bold" />
<TextView
android:id="#+id/txtmorning"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="serif"
android:gravity="start"
android:singleLine="true"
android:textColor="#color/darkgrey" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:drawableLeft="#drawable/bike"
android:drawablePadding="#dimen/_5sdp"
android:fontFamily="serif"
android:gravity="center"
android:singleLine="true"
android:text="EVENING : "
android:textColor="#color/darkgrey"
android:textStyle="bold" />
<TextView
android:id="#+id/txtevening"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:fontFamily="serif"
android:gravity="start"
android:singleLine="true"
android:textColor="#color/darkgrey" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:drawableLeft="#drawable/bike"
android:drawablePadding="#dimen/_5sdp"
android:fontFamily="serif"
android:gravity="center"
android:singleLine="true"
android:text="EXPRESS TIME : "
android:textColor="#color/darkgrey"
android:textStyle="bold" />
<TextView
android:id="#+id/txtexpresscharges"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:fontFamily="serif"
android:gravity="start"
android:singleLine="true"
android:textColor="#color/darkgrey" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
<LinearLayout
android:id="#+id/search_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_40sdp"
android:layout_marginBottom="70dp"
android:background="#color/colorAccent"
android:orientation="vertical">
<!--<SearchView
android:id="#+id/searchView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:clickable="true" />
-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="#dimen/_35sdp"
android:layout_weight="2"
android:background="#drawable/ed_border"
android:orientation="horizontal">
<EditText
android:id="#+id/edtSearchBox"
android:layout_width="wrap_content"
android:layout_height="#dimen/_30sdp"
android:layout_below="#id/toolbar"
android:layout_margin="#dimen/_4sdp"
android:layout_weight="3"
android:background="#color/whiteTextColor"
android:drawableStart="#drawable/ic_search_black_24dp"
android:drawablePadding="#dimen/_5sdp"
android:fontFamily="serif"
android:inputType="text"
android:paddingLeft="#dimen/_8sdp"
android:singleLine="true"
android:textSize="#dimen/_11sdp">
</EditText>
<ImageButton
android:id="#+id/imgbutton"
android:layout_width="wrap_content"
android:layout_height="#dimen/_25sdp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_margin="#dimen/_7sdp"
android:layout_weight="0.4"
android:background="#null"
android:scaleType="fitXY"
android:src="#drawable/ic_mic_black_24dp">
</ImageButton>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/searchRecyclerLinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_75sdp"
android:visibility="gone">
<android.support.v7.widget.RecyclerView
android:id="#+id/searchRecyclerFromSearchView"
class="android.support.v7.widget.RecyclerView"
android:layout_width="match_parent"
android:nestedScrollingEnabled="false"
android:isScrollContainer="false"
android:layout_height="wrap_content"
android:background="#color/profileAccentColor"
android:divider="#ad5"
android:dividerHeight="2dp" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.v4.widget.SwipeRefreshLayout>
</FrameLayout>
Try to use multiple shimmer layouts inside your linear layout.
Related
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/swipe_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="#dimen/recycler_view_padding_top"
android:paddingStart="#dimen/recycler_view_padding_start"
android:paddingEnd="#dimen/recycler_view_padding_end" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="#+id/button_add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="#dimen/fab_horizontal_margin"
android:layout_marginBottom="#dimen/fab_vertical_margin"
android:layout_gravity="bottom|end"
android:src="#drawable/ic_add_button"
android:visibility="gone"
app:fabSize="mini"
app:maxImageSize="#dimen/fab_max_image_size"
tools:visibility="visible"
/>
</FrameLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
Above is my RecyclerView which displays list on multiple screen.(One layout displays on multiple screens)
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
xmlns:app="http://schemas.android.com/apk/res-auto">
<RadioGroup
android:id="#+id/radio1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorAccentSecondary"
android:orientation="horizontal"
android:gravity="center"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="#id/radio2"
>
<Button
android:id="#+id/button"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_gravity="center_vertical"
android:text="#string/label_random_question"
style="#style/TrainingButtonStyle"
/>
<Button
android:id="#+id/button2"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:text="#string/label_start_question"
style="#style/TrainingButtonStyle"
/>
</RadioGroup>
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/radio2"
android:gravity="center"
android:orientation="horizontal"
android:background="#color/question_training_background"
app:layout_constraintTop_toBottomOf="#+id/radio1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/button3"
android:layout_gravity="center_vertical"
android:layout_marginEnd="10dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:text="#string/label_all_question"
style="#style/TrainingButtonStyle"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/button4"
android:layout_gravity="center_vertical"
android:layout_marginEnd="10dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:text="#string/label_10_question"
style="#style/TrainingButtonStyle"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/button5"
android:layout_gravity="center_vertical"
android:layout_marginEnd="10dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:text="#string/label_20_question"
style="#style/TrainingButtonStyle"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/button6"
android:layout_gravity="center_vertical"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:text="#string/label_30_question"
style="#style/TrainingButtonStyle"
/>
</RadioGroup>
</androidx.constraintlayout.widget.ConstraintLayout>
this is my other View(which contains button) which i have to add at the bottom of RecyclerView not inside.(Only on particular screen not on multiple screen display)
****what can be done so that i can set the view (Containing buttons) at the bottom of the screen? (i am not able to add the view.) ****
Please share some of your code that can be useful to answer as well (as the layout xml).
What you could do is to put into your View a Layout with a given id.
Then in your activity set the visibility of the layout you want to hide as "GONE", as:
findViewById<LinearLayout>(R.id.page_layout_3).visibility = View.GONE // this goes into the activity
See the following example where the LinearLayout with id "page_layout_3" is hide as I wrote.
The following layout will generate a page having a Scrollable List and with the navbar at the bottom.
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:id="#+id/main_layout">
<LinearLayout
android:id="#+id/coordinator_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="#+id/page_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<com.google.android.material.button.MaterialButton
android:id="#+id/connectBtn"
android:layout_width="250dp"
android:layout_height="60dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="20dp"
android:gravity="center"
android:text="Scan">
></com.google.android.material.button.MaterialButton>
<ProgressBar
android:id="#+id/progress_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="invisible" />
<ListView
android:id="#+id/discoveredDevices"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"/>
<LinearLayout
android:id="#+id/page_layout_3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center|bottom"
android:orientation="horizontal">
<com.google.android.material.button.MaterialButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="BTN 1"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"/>
<com.google.android.material.button.MaterialButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="BTN 2"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"/>
<com.google.android.material.button.MaterialButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="BTN 2"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
You can replace the ListView with your ReciclerView.
UPDATE ANSWER:
Once you have your "recyvleviewlayout.xml" or whatever, you can include it using the Include tag provided by android (https://developer.android.com/training/improving-layouts/reusing-layouts), so you can use or not pending on the activity (screen?) you are in.
Make sure you have a layout base where to include it by having a layout for every activity.
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout 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:id="#+id/swipe_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include layout="#layout/recyvleviewlayout"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom"
android:orientation="vertical">
<RadioGroup
android:id="#+id/radio1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center|bottom"
android:orientation="horizontal"
app:layout_constraintBottom_toTopOf="#id/radio2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<Button
android:id="#+id/button"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:text="label_random_question" />
<Button
android:id="#+id/button2"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:text="label_start_question" />
</RadioGroup>
<RadioGroup
android:id="#+id/radio2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/radio1">
<Button
android:id="#+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:text="label_all_question" />
<Button
android:id="#+id/button4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:text="label_10_question" />
<Button
android:id="#+id/button5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:text="label_20_question" />
<Button
android:id="#+id/button6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="label_30_question" />
</RadioGroup>
</LinearLayout>
</RelativeLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
I'm having issues getting the height of my linear layout to automatically increase to fit my content. As you can see in the screenshot below, the date text gets cut off. Any ideas on how to fix this, please? Thank you.
<LinearLayout
android:id="#+id/boxes_view_case_details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="8dp"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
app:layout_constraintTop_toBottomOf="#id/color_bar_case_details"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:weightSum="3">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="1"
android:background="#color/white"
android:elevation="6dp"
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:weightSum="2">
<TextView
android:id="#+id/form_type_case_details"
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="N-400"
android:background="#color/white"
android:textStyle="bold"
android:textColor="#color/black"
android:textSize="17sp"
android:gravity="center"
android:layout_weight="1.2"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="Form"
android:textColor="#color/black"
android:textSize="10sp"
android:layout_weight="0.8"
android:gravity="center"
android:layout_marginBottom="4dp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="1"
android:background="#color/white"
android:elevation="6dp"
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:gravity="center"
android:weightSum="2">
<TextView
android:id="#+id/last_updated_date_case_details"
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="Apr 13, 2021"
android:textStyle="bold"
android:textColor="#color/black"
android:textSize="17sp"
android:layout_weight="1.2"
android:gravity="center"
android:layout_marginTop="4dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="Last Updated"
android:textColor="#color/black"
android:textSize="10sp"
android:layout_weight="0.8"
android:gravity="center"
android:layout_marginBottom="4dp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="1"
android:background="#color/white"
android:elevation="6dp"
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:gravity="center"
android:weightSum="2">
<TextView
android:id="#+id/days_since_case_details"
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="19"
android:textStyle="bold"
android:textColor="#color/black"
android:textSize="17sp"
android:gravity="center"
android:layout_weight="1.2"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="Days Since\nLast Update"
android:textColor="#color/black"
android:textSize="10sp"
android:textAlignment="center"
android:layout_weight="0.8"
android:layout_marginBottom="4dp"
/>
</LinearLayout>
</LinearLayout>
I have seen so many examples, but I haven't found any swipable recycler view in horizontal mode.
I want to create recycler view whose item covers whole screen, and i want to swipe to next item, don't want to scroll because it stuck in the middle of two items.
There is my Layout:
<?xml version="1.0" encoding="utf-8"?>
<!-- A CardView that contains a TextView -->
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="#+id/card_view"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
card_view:cardCornerRadius="6dp"
card_view:cardElevation="4dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:weightSum="1"
android:padding="2dp"
android:orientation="vertical"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.35">
<ImageView android:layout_width="match_parent"
android:maxWidth="340dp"
android:minWidth="300dp"
android:layout_weight="0.35"
android:layout_height="fill_parent"
android:contentDescription="#string/app_name"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:id="#+id/row_image"
android:layout_gravity="center_horizontal" />
<TextView
android:layout_width="wrap_content"
android:minWidth="100dp"
android:layout_height="40dp"
android:padding="5dp"
android:gravity="center"
android:text="Status"
android:textSize="#dimen/appcard_textSize"
android:id="#+id/row_status"
android:visibility="gone"
android:textColor="#color/PrimaryColor"
android:layout_alignParentRight="true"
android:layout_marginRight="5dp"
android:layout_marginBottom="5dp"
android:layout_alignParentBottom="true"
/>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:layout_weight="0.65"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="24dp"
android:layout_marginTop="5dp"
android:orientation="horizontal">
<TextView
android:id="#+id/info_designcode"
android:layout_width="match_parent"
android:layout_height="24dp"
android:text="Design Code"
android:textSize="#dimen/appcard_textSize"
android:layout_weight="1"
android:singleLine="true"/>
<TextView
android:id="#+id/info_outcode"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="24dp"
android:textSize="#dimen/appcard_textSize"
android:text="Outlet Code"/>
<ImageView
android:layout_width="30dp"
android:visibility="invisible"
android:layout_marginRight="2dp"
android:layout_height="24dp"
android:id="#+id/img_attach"
android:background="#drawable/ic_action_attachment"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="24dp"
android:orientation="horizontal"
android:layout_marginRight="30dp">
<TextView
android:id="#+id/info_KaragirCode"
android:layout_width="match_parent"
android:layout_height="24dp"
android:layout_weight="1"
android:textSize="#dimen/appcard_textSize"
android:text="Karagir Code"
android:singleLine="true"/>
<TextView
android:id="#+id/info_DiaCrt"
android:layout_width="match_parent"
android:layout_height="24dp"
android:layout_weight="1"
android:textSize="#dimen/appcard_textSize"
android:text=""
android:singleLine="true"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="24dp"
android:orientation="horizontal"
android:layout_marginRight="30dp">
<TextView
android:id="#+id/info_weight"
android:layout_width="match_parent"
android:layout_height="24dp"
android:textSize="#dimen/appcard_textSize"
android:text=""
android:layout_weight="1"
android:singleLine="true"/>
<TextView
android:id="#+id/info_cc"
android:layout_width="match_parent"
android:layout_height="24dp"
android:textSize="#dimen/appcard_textSize"
android:text=""
android:layout_weight="1"
android:singleLine="true"/>
</LinearLayout>
<LinearLayout
android:id="#+id/lyt_hotperl"
android:layout_width="match_parent"
android:layout_height="24dp"
android:orientation="horizontal"
android:layout_marginRight="30dp">
<TextView
android:id="#+id/info_hot"
android:layout_width="match_parent"
android:layout_height="24dp"
android:textSize="#dimen/appcard_textSize"
android:text=""
android:layout_weight="1"
android:singleLine="true"/>
<TextView
android:id="#+id/info_pearl"
android:layout_width="match_parent"
android:layout_height="24dp"
android:textSize="#dimen/appcard_textSize"
android:text=""
android:layout_weight="1"
android:singleLine="true"/>
</LinearLayout>
<LinearLayout
android:id="#+id/lyt_ODD"
android:visibility="visible"
android:layout_width="match_parent"
android:layout_height="24dp"
android:orientation="horizontal"
android:layout_marginRight="30dp">
<TextView
android:id="#+id/info_orderdeldate"
android:layout_width="match_parent"
android:layout_height="24dp"
android:textSize="#dimen/appcard_textSize"
android:text=""
android:layout_weight="1"
android:singleLine="true"/>
<TextView
android:id="#+id/info_price"
android:layout_width="match_parent"
android:layout_height="24dp"
android:textSize="#dimen/appcard_textSize"
android:text=""
android:layout_weight="1"
android:singleLine="true"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="35dp"
android:orientation="horizontal">
<TextView
android:id="#+id/info_orderno"
android:layout_width="match_parent"
android:layout_height="24dp"
android:textSize="#dimen/appcard_textSize"
android:text=""
android:layout_weight="1"
android:singleLine="true"/>
<Button
android:layout_width="wrap_content"
android:layout_height="30dp"
android:id="#+id/btnUrgent"
android:textSize="14sp"
android:visibility="gone"
android:textColor="#color/ColorWhite"
android:background="#color/colorUrgent"
android:text="Urgent"
android:layout_marginRight="2dp"
android:layout_marginBottom="2dp"
/>
</LinearLayout>
<TextView
android:id="#+id/info_text"
android:layout_width="match_parent"
android:singleLine="true"
android:textSize="#dimen/appcard_textSize"
android:visibility="gone"
android:layout_height="24dp"
/>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
I think you need to use another component for that. RecyclerView is extending listView, that intends to scroll most of the time. But there are some other component that can swipe.
I want to add btton(button1) at the bottom of screen ,whish will be displayed always.,regardless of anount of data inside scrollview.
My button1 is not displaying at the bottom of the screen.
Anyone know,where I am mistaken?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffffff">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center">
<TextView
android:text="Step 1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/step1TextView"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:textStyle="normal"
android:textColor="#ff000000"
android:layout_alignParentLeft="true" />
<TextView
android:text="Step 2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/step2TextView"
android:textStyle="bold"
android:textColor="#ff000000"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:layout_toRightOf="#+id/step1TextView"
android:gravity="center" />
<TextView
android:text="Step 3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/step3TextView"
android:textStyle="normal"
android:textColor="#ff000000"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_gravity="center_horizontal"
android:layout_toRightOf="#+id/step2TextView"
android:layout_alignParentRight="true"
android:layout_alignWithParentIfMissing="true" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ffffffff"
android:layout_below="#+id/step1TextView">
<RelativeLayout
android:id="#+id/highlightFooter1Layout"
android:layout_width="fill_parent"
android:layout_height="10dp"
android:background="#ffffffff">
<LinearLayout
android:id="#+id/highlightFooter11Layout"
android:layout_width="2dp"
android:layout_height="70dp"
android:background="#ffe9e9e9"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp" />
<LinearLayout
android:id="#+id/highlightFooter12Layout"
android:layout_width="2dp"
android:layout_height="70dp"
android:background="#000000"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_toRightOf="#+id/highlightFooter11Layout" />
<LinearLayout
android:id="#+id/highlightFooter13Layout"
android:layout_width="2dp"
android:layout_height="70dp"
android:background="#ffe9e9e9"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_toRightOf="#+id/highlightFooter12Layout" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/highlightFooter2Layout"
android:layout_width="fill_parent"
android:layout_height="10dp"
android:background="#ffe9e9e9"
android:layout_below="#+id/highlightFooter1Layout">
<LinearLayout
android:id="#+id/highlightFooter21Layout"
android:layout_width="50dp"
android:layout_height="5dp"
android:background="#ffff8b03"
android:layout_alignParentTop="true"
android:layout_marginLeft="65dp" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:text="Your phone number has been successfully verified . Please enter the following details to begin."
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/textView1"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_marginRight="10dp"
android:background="#ffffffff"
android:textColor="#ff000000" />
<Spinner
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/stateSpinner"
android:background="#ffe9e9e9"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:layout_weight="1" />
<Spinner
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/districtSpinner"
android:background="#ffe9e9e9"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:layout_weight="1" />
<Spinner
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/constSpinner"
android:background="#ffe9e9e9"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:layout_weight="1" />
<EditText
android:inputType="number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/editText1"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:background="#ffe9e9e9" />
<ImageView
android:src="#android:drawable/ic_menu_gallery"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/imageView1" />
<TextView
android:text="Chief Minister"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/cmTextView"
android:gravity="center" />
<TextView
android:text="cm name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/cmNametextView"
android:gravity="center"
android:textColor="#ffff8b03" />
<TextView
android:text="Member of Parliament"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/mpTextView"
android:gravity="center" />
<TextView
android:text="mp name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/mpNameTextView"
android:gravity="center"
android:textColor="#ffff8b03" />
<TextView
android:text="Member of Legislative Assembly"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/mlaTextView"
android:gravity="center" />
<TextView
android:text="mla name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/mlaNameTextView"
android:gravity="center"
android:textColor="#ffff8b03" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="#+id/buttonLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<Button
android:text="Next"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/button1"
android:layout_gravity="bottom"
android:autoText="false"
android:layout_weight="1"
android:layout_marginLeft="0dp"
android:layout_marginTop="0dp"
android:layout_marginRight="0dp"
android:layout_marginBottom="0dp"
android:background="#ffff8b03"
android:textStyle="bold"
android:textColor="#ffffffff"
android:textSize="20dp"
android:minHeight="50dp"
android:maxHeight="50dp" />
</LinearLayout>
As Casper suggested add the </LinearLayout> at the end of your xml and add android:layout_weight="1" to you ScrollView and remove it from LinearLayout with your button.
I have multiple linear layouts and I need to add a few more items. Them first layout holds the background image. I'm not sure if that is where it should be but if I put that image into another layout it seems like it gets put on-top of everything else and I can not see the other items. I think I need to wrap the entire layout with something and make it scrollable. I just do not know what. Each time I add the ScrollView to the LinearLayout I get the exception "ScrollView can host only one child..." Code is below.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/dsbackground"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal"
android:weightSum="100" >
<EditText
android:id="#+id/custinfo"
android:layout_width="165dp"
android:layout_height="75dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:hint=" Customer Name/Job Name/Job Zip"
android:inputType="textMultiLine"
android:lines="3"
android:textSize="15dp" />
<EditText
android:id="#+id/discount"
android:layout_width="40dp"
android:layout_height="37dp"
android:layout_marginLeft="50dp"
android:layout_marginTop="32dp"
android:layout_weight="25"
android:hint=" %"
android:inputType="number"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal"
android:weightSum="100" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="25"
android:gravity="center"
android:text="Width"
android:textStyle="bold" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="25"
android:gravity="center"
android:text="Length"
android:textStyle="bold" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="25"
android:gravity="center"
android:text="Eave"
android:textStyle="bold" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="25"
android:gravity="center"
android:text="Pitch"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal"
android:weightSum="100" >
<EditText
android:id="#+id/width"
android:layout_width="fill_parent"
android:layout_height="37dp"
android:layout_weight="25"
android:gravity="center"
android:inputType="number"
android:textStyle="bold" >
</EditText>
<EditText
android:id="#+id/length"
android:layout_width="fill_parent"
android:layout_height="37dp"
android:layout_weight="25"
android:gravity="center"
android:inputType="number"
android:textStyle="bold" >
</EditText>
<EditText
android:id="#+id/eave"
android:layout_width="fill_parent"
android:layout_height="37dp"
android:layout_weight="25"
android:gravity="center"
android:inputType="number"
android:textStyle="bold" >
</EditText>
<EditText
android:id="#+id/pitch"
android:layout_width="fill_parent"
android:layout_height="37dp"
android:layout_weight="25"
android:gravity="center"
android:inputType="number"
android:textStyle="bold" >
</EditText>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:orientation="horizontal"
android:weightSum="100" >
<TextView
android:layout_width="58dp"
android:layout_height="wrap_content"
android:layout_marginLeft="17dp"
android:gravity="left"
android:text="ROOF"
android:textSize="17dp"
android:textStyle="bold" />
<EditText
android:id="#+id/roofsqft"
android:layout_width="110dp"
android:layout_height="37dp"
android:layout_weight="25.32"
android:hint="SQFT"
android:inputType="number"
android:textStyle="bold" />
<EditText
android:id="#+id/rooftotal"
android:layout_width="90dp"
android:layout_height="37dp"
android:layout_marginLeft="5dp"
android:layout_weight="25.32"
android:hint="Total" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal"
android:weightSum="100" >
<Spinner
android:id="#+id/Spinnerrvalue"
android:layout_width="wrap_content"
android:layout_height="37dp"
android:entries="#array/rvalue"
android:prompt="#string/rvalue" />
<Spinner
android:id="#+id/spinnerfacing"
android:layout_width="wrap_content"
android:layout_height="37dp"
android:entries="#array/facing"
android:prompt="#string/facing" />
<EditText
android:id="#+id/roofprice"
android:layout_width="wrap_content"
android:layout_height="36dp"
android:layout_gravity="center"
android:layout_weight="34.48"
android:hint="Price"
android:inputType="number"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:orientation="horizontal"
android:weightSum="100" >
<TextView
android:layout_width="58dp"
android:layout_height="wrap_content"
android:layout_marginLeft="17dp"
android:gravity="left"
android:text="WALL"
android:textSize="17dp"
android:textStyle="bold" />
<EditText
android:id="#+id/wallsqft"
android:layout_width="110dp"
android:layout_height="37dp"
android:layout_weight="25.32"
android:hint="SQFT"
android:inputType="number"
android:textStyle="bold" />
<EditText
android:id="#+id/walltotal"
android:layout_width="90dp"
android:layout_height="37dp"
android:layout_marginLeft="5dp"
android:layout_weight="25.32"
android:hint="Total" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal"
android:weightSum="100" >
<Spinner
android:id="#+id/Spinnerrvalue"
android:layout_width="wrap_content"
android:layout_height="37dp"
android:entries="#array/rvalue"
android:prompt="#string/rvalue" />
<Spinner
android:id="#+id/spinnerfacing"
android:layout_width="wrap_content"
android:layout_height="37dp"
android:entries="#array/facing"
android:prompt="#string/facing" />
<EditText
android:id="#+id/wallprice"
android:layout_width="wrap_content"
android:layout_height="36dp"
android:layout_gravity="center"
android:layout_weight="34.48"
android:hint="Price"
android:inputType="number"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="horizontal"
android:weightSum="100" >
<EditText
android:id="#+id/roofaddition"
android:layout_width="wrap_content"
android:layout_height="36dp"
android:layout_gravity="center"
android:layout_marginLeft="15dp"
android:hint="Roof Addition"
android:inputType="number"
android:textStyle="bold" />
<EditText
android:id="#+id/walldeduct"
android:layout_width="wrap_content"
android:layout_height="36dp"
android:layout_gravity="center"
android:layout_marginLeft="15dp"
android:hint="Wall Deducts"
android:inputType="number"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:orientation="horizontal"
android:weightSum="100" >
<Button
android:id="#+id/process"
android:layout_width="125dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="PROCESS" />
<EditText
android:id="#+id/total"
android:layout_width="125dp"
android:layout_height="43dp"
android:layout_gravity="center"
android:layout_marginLeft="42dp"
android:hint=" Total "
android:inputType="number"
android:textStyle="bold" />
</LinearLayout>
try this:
(pseudo code)
<LinearLayout
android:background= "your background"
>
<Scrollview>
<Linear layout>
<Your layout>
</Your layout>
</Linear layout>
</scrollview>
<Linearlayout>
if u don't understand, write here