I have an Activity that has multiple TextViews and one ListView at the end of it. I noticed that the ListView has its own Scroll down, what I want to do is disable the ListView scroll down and create one ScrollView for the whole screen. Can I do that?
This is the XML for the Activity:
Edit: I added a scrollView for the screen but it's somehow affecting the ListView because it only shows one item of the list.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbarOrderDetail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#drawable/topbg"
android:minHeight="?attr/actionBarSize">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/lblBackButtonOrderDetail"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:onClick="goBackToTabs"
android:layout_marginTop="#dimen/margin_five"
android:drawableLeft="#drawable/back" />
<TextView
android:id="#+id/lblOrderDetailHeader"
fontPath="fonts/Roboto-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="Order Details"
android:textSize="21sp" />
</RelativeLayout>
</android.support.v7.widget.Toolbar>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center|left"
android:orientation="vertical"
android:paddingLeft="8dp"
android:paddingRight="8dp">
<TextView
android:id="#+id/lblOrderId"
fontPath="fonts/Roboto-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/toolbarOrderDetail"
android:layout_marginLeft="#dimen/margin_ten"
android:layout_marginTop="#dimen/margin_ten"
android:text="#string/order_id"
android:textSize="#dimen/activity_horizontal_margin" />
<TextView
android:id="#+id/lblOrderIdData"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/lblOrderId"
android:layout_alignTop="#+id/lblOrderId"
android:layout_below="#+id/toolbarOrderDetail"
android:layout_marginLeft="#dimen/margin_ten"
android:layout_toRightOf="#+id/lblOrderId"
android:gravity="center"
android:text="" />
<View
android:id="#+id/viewOrder1"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/lblOrderId"
android:layout_marginTop="#dimen/margin_ten"
android:background="#color/line_color"></View>
<TextView
android:id="#+id/lblBeestroNameHeader"
fontPath="fonts/Roboto-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/viewOrder1"
android:layout_marginLeft="#dimen/margin_ten"
android:layout_marginTop="#dimen/margin_ten"
android:text="#string/bistro_name"
android:textSize="#dimen/activity_horizontal_margin" />
<TextView
android:id="#+id/lblBistroName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/lblBeestroNameHeader"
android:layout_alignTop="#+id/lblBeestroNameHeader"
android:layout_marginLeft="#dimen/margin_ten"
android:layout_toRightOf="#+id/lblBeestroNameHeader"
android:gravity="center"
android:text="" />
<View
android:id="#+id/viewOrder2"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/lblBeestroNameHeader"
android:layout_marginTop="#dimen/margin_ten"
android:background="#color/line_color"></View>
<TextView
android:id="#+id/lblOrderStatus"
fontPath="fonts/Roboto-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/viewOrder2"
android:layout_marginLeft="#dimen/margin_ten"
android:layout_marginTop="#dimen/margin_ten"
android:text="#string/order_status"
android:textSize="#dimen/activity_horizontal_margin" />
<TextView
android:id="#+id/lblOrder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/lblOrderStatus"
android:layout_alignTop="#+id/lblOrderStatus"
android:layout_marginLeft="#dimen/margin_ten"
android:layout_toRightOf="#+id/lblOrderStatus"
android:gravity="center"
android:text=""
android:textColor="#android:color/holo_red_light" />
<View
android:id="#+id/viewOrder3"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/lblOrderStatus"
android:layout_marginTop="#dimen/margin_ten"
android:background="#color/line_color"></View>
<TextView
android:id="#+id/lblPaymentMethodHeader"
fontPath="fonts/Roboto-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/viewOrder3"
android:layout_marginLeft="#dimen/margin_ten"
android:layout_marginTop="#dimen/margin_ten"
android:text="#string/payment_method"
android:textSize="#dimen/activity_horizontal_margin" />
<TextView
android:id="#+id/lblPaymentMethod"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/lblPaymentMethodHeader"
android:layout_alignTop="#+id/lblPaymentMethodHeader"
android:layout_marginLeft="#dimen/margin_ten"
android:layout_toRightOf="#+id/lblPaymentMethodHeader"
android:gravity="center"
android:text="" />
<View
android:id="#+id/viewOrder4"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/lblPaymentMethod"
android:layout_marginTop="#dimen/margin_ten"
android:background="#color/line_color"></View>
<TextView
android:id="#+id/lblDate"
fontPath="fonts/Roboto-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/viewOrder4"
android:layout_marginLeft="#dimen/margin_ten"
android:layout_marginTop="#dimen/margin_ten"
android:text="Date: "
android:textSize="#dimen/activity_horizontal_margin" />
<TextView
android:id="#+id/lblDateTxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/lblDate"
android:layout_alignTop="#+id/lblDate"
android:layout_marginLeft="#dimen/margin_ten"
android:layout_toRightOf="#+id/lblDate"
android:gravity="center"
android:text="" />
<View
android:id="#+id/viewOrder5"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/lblDate"
android:layout_marginTop="#dimen/margin_ten"
android:background="#color/line_color"></View>
<TextView
android:id="#+id/lblTime"
fontPath="fonts/Roboto-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/viewOrder5"
android:layout_marginLeft="#dimen/margin_ten"
android:layout_marginTop="#dimen/margin_ten"
android:text="Time: "
android:textSize="#dimen/activity_horizontal_margin" />
<TextView
android:id="#+id/lblTimeTxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/lblTime"
android:layout_alignTop="#+id/lblTime"
android:layout_marginLeft="#dimen/margin_ten"
android:layout_toRightOf="#+id/lblTime"
android:gravity="center"
android:text="" />
<View
android:id="#+id/viewOrder6"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/lblTime"
android:layout_marginTop="#dimen/margin_ten"
android:background="#color/line_color"></View>
<TextView
android:id="#+id/lblTotal"
fontPath="fonts/Roboto-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/viewOrder6"
android:layout_marginLeft="#dimen/margin_ten"
android:layout_marginTop="#dimen/margin_ten"
android:text="Total Price: "
android:textSize="#dimen/activity_horizontal_margin" />
<TextView
android:id="#+id/lblTotalTxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/lblTotal"
android:layout_alignTop="#+id/lblTotal"
android:layout_marginLeft="#dimen/margin_ten"
android:layout_toRightOf="#+id/lblTotal"
android:gravity="center"
android:text="" />
<View
android:id="#+id/viewOrder7"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/lblTotal"
android:layout_marginTop="#dimen/margin_ten"
android:background="#color/line_color"></View>
<TextView
android:id="#+id/lblItem"
fontPath="fonts/Roboto-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/viewOrder7"
android:layout_marginLeft="#dimen/margin_ten"
android:layout_marginTop="#dimen/margin_ten"
android:text="Items Ordered:"
android:textSize="#dimen/activity_horizontal_margin" />
<TextView
android:id="#+id/lblItem1"
fontPath="fonts/Roboto-Bold.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/lblItem"
android:layout_marginLeft="#dimen/margin_ten"
android:layout_marginTop="#dimen/margin_ten"
android:text="Name/Quantity/Price"
android:textSize="#dimen/activity_horizontal_margin" />
<ListView
android:id="#+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/lblItem1"
android:layout_marginBottom="#dimen/margin_ten"
android:layout_marginTop="#dimen/margin_ten"
android:background="#android:color/transparent"
android:divider="#color/line_color"
android:dividerHeight="1dp"
android:scrollbars="none" />
<include
android:id="#+id/beeGif"
layout="#layout/view_bee_animation"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerInParent="true"></include>
</LinearLayout>
</ScrollView>
</LinearLayout>
This should work.
listView.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
return true;
}
});
Related
The .xml file is attached below.
The issue is my recycler view is not scrolling.
Also, to show how I'm adding Linearlayout manager, the code is below.
variantRecycler.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
ViewCompat. setNestedScrollingEnabled(variantRecycler, false);
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
android:layout_width="match_parent"
android:background="#color/transparent"
android:layout_height="match_parent">
<TextView
android:id="#+id/cross_icon"
style="#style/icon"
android:layout_width="#dimen/_30dp"
android:layout_height="#dimen/_30dp"
android:layout_gravity="right"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="#dimen/_10dp"
android:layout_marginRight="#dimen/_20dp"
android:layout_marginBottom="#dimen/_30dp"
android:background="#drawable/circular_cross_button" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_40dp"
android:background="#color/app_grey"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/product_details_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/white">
<TextView
android:id="#+id/pick_your_option_label"
style="#style/subheading_manrope_bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/_15dp"
android:layout_marginTop="#dimen/_15dp"
android:layout_marginBottom="#dimen/_10dp"
android:text="#string/pick_your_option"
android:textColor="#color/product_name_lite_black_color"
android:textSize="#dimen/_18dp"
android:visibility="gone" />
<View
android:id="#+id/line1"
android:layout_width="match_parent"
android:layout_height="#dimen/_1dp"
android:layout_below="#id/pick_your_option_label"
android:layout_marginLeft="#dimen/_15dp"
android:layout_marginTop="#dimen/_10dp"
android:layout_marginRight="#dimen/_15dp"
android:layout_marginBottom="#dimen/_15dp"
android:background="#color/line_color"
android:visibility="invisible" />
<androidx.viewpager2.widget.ViewPager2
android:id="#+id/view_pager"
android:layout_width="#dimen/_136dp"
android:layout_height="#dimen/_136dp"
android:layout_below="#id/line1"
android:layout_marginLeft="#dimen/_16dp"
android:layout_marginTop="#dimen/_12dp"
android:layout_marginRight="#dimen/_12dp"
android:layout_marginBottom="#dimen/_8dp"
android:background="#drawable/grey_border_rounder_rectangle_8dp"
android:padding="#dimen/_1dp"
android:transitionName="#string/image" />
<LinearLayout
android:id="#+id/pager_dots"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/view_pager"
android:layout_gravity="center"
android:layout_marginLeft="#dimen/_16dp"
android:layout_marginBottom="#dimen/_15dp"
android:background="#android:color/transparent"
android:orientation="horizontal" />
<ImageView
android:id="#+id/product_image"
android:layout_width="#dimen/_120dp"
android:layout_height="#dimen/_120dp"
android:layout_marginLeft="#dimen/_10dp"
android:layout_marginRight="#dimen/_8dp"
android:layout_marginBottom="#dimen/_15dp"
android:transitionName="#string/image"
android:visibility="gone" />
<ImageView
android:id="#+id/elite_image"
android:layout_width="#dimen/_16dp"
android:layout_height="#dimen/_16dp"
android:layout_below="#id/line1"
android:layout_marginLeft="#dimen/_15dp"
android:visibility="gone"
app:srcCompat="#drawable/elite_icon" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
</RelativeLayout>
<TextView
android:id="#+id/product_name"
style="#style/body_manrope_bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/line1"
android:layout_marginTop="#dimen/_12dp"
android:layout_marginRight="#dimen/_10dp"
android:layout_toRightOf="#id/view_pager"
android:ellipsize="end"
android:maxLines="2"
android:textColor="#color/product_name_lite_black_color" />
<View
android:id="#+id/view"
android:layout_width="1dp"
android:layout_toRightOf="#id/product_name"
android:layout_marginTop="#dimen/_12dp"
android:layout_marginLeft="#dimen/_3dp"
android:background="#color/divider_grey"
android:layout_height="#dimen/_35dp"/>
<TextView
style="#style/icon"
android:id="#+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_12dp"
android:layout_gravity="center"
android:layout_toRightOf="#+id/view"
android:layout_marginLeft="#dimen/_3dp"
android:layout_marginRight="#dimen/_5dp"
android:background="?selectableItemBackground"
android:gravity="center"
android:text="#string/camera_icon_id"
android:textSize="#dimen/_24dp"
android:textStyle="bold" />
<TextView
android:id="#+id/try_on"
style="#style/subheading_manrope_bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_3dp"
android:layout_toRightOf="#id/view"
android:layout_below="#+id/icon"
android:textColor="#color/add_to_cart_violet" />
<TextView
android:id="#+id/price"
style="#style/subheading_manrope_bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/product_name"
android:layout_marginTop="#dimen/_8dp"
android:layout_toRightOf="#id/view_pager"
android:textColor="#color/product_name_lite_black_color" />
<TextView
android:id="#+id/offer_price"
style="#style/subheading_manrope_bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/product_name"
android:layout_marginLeft="#dimen/_4dp"
android:layout_marginTop="#dimen/_8dp"
android:layout_toRightOf="#id/price"
android:textColor="#color/product_mrp_lite_gray_color" />
<TextView
android:id="#+id/save_offer"
style="#style/caption_manrope_medium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/product_name"
android:layout_marginLeft="#dimen/_4dp"
android:layout_marginTop="#dimen/_10dp"
android:layout_toRightOf="#id/offer_price"
android:textColor="#color/product_offer_price_color"
android:textSize="#dimen/_13dp"
android:visibility="gone" />
<TextView
android:id="#+id/offer_percantage"
style="#style/caption_manrope_medium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/product_name"
android:layout_marginLeft="#dimen/_2dp"
android:layout_marginTop="#dimen/_10dp"
android:layout_toRightOf="#id/save_offer"
android:textColor="#color/product_offer_price_color"
android:textSize="#dimen/_13dp" />
<include
layout="#layout/new_rating_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/price"
android:layout_marginTop="#dimen/_8dp"
android:layout_toRightOf="#id/view_pager" />
<TextView
android:id="#+id/product_qty"
style="#style/caption_manrope_medium2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/new_rating_layout"
android:layout_marginLeft="#dimen/_12dp"
android:layout_marginTop="#dimen/_11dp"
android:layout_toRightOf="#id/view_pager"
android:gravity="center_vertical"
android:text="20ml"
android:textColor="#color/ash_gray"
android:textSize="#dimen/_10dp" />
<HorizontalScrollView
android:layout_below="#+id/product_qty"
android:layout_toRightOf="#id/view_pager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_6dp"
android:layout_marginLeft="#dimen/_12dp"
android:scrollbars="none">
<com.google.android.material.chip.ChipGroup
android:id="#+id/chip_group"
app:singleLine="true"
app:singleSelection="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</HorizontalScrollView>
<View
android:id="#+id/line2"
android:layout_width="match_parent"
android:layout_height="#dimen/_1dp"
android:layout_below="#id/view_pager"
android:layout_marginLeft="#dimen/_15dp"
android:layout_marginTop="#dimen/_10dp"
android:layout_marginRight="#dimen/_15dp"
android:layout_marginBottom="#dimen/_10dp"
android:background="#color/line_color"
android:visibility="invisible" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/product_details_layout"
android:layout_marginTop="#dimen/_8dp"
android:background="#color/white">
<TextView
android:id="#+id/shades_label"
style="#style/body_manrope_bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/_2dp"
android:layout_marginTop="#dimen/_8dp"
android:layout_marginBottom="#dimen/_5dp"
android:layout_toRightOf="#+id/shade"
android:textColor="#color/dark_gray_color"
android:textStyle="bold"
android:visibility="gone" />
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/variant_recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:nestedScrollingEnabled="false"
android:layout_below="#+id/shade"
/>
</RelativeLayout>
</RelativeLayout>
<include
layout="#layout/variant_pop_up_bottom_bar_layout"
android:visibility="visible"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
I,m designing one layout file which contain education information , earlier information was not fitting into screen so I have added Scroll view. I'm able to scroll down the screen but not completely. I tried putt scrollView top of all the relative layout, but it not scrolling completely, i tried enter link description here but not able to resolve my problem.
need help?
fragment_education.xml
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/slide_title"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="#dimen/slide_title"
android:background="#color/Blue"
android:paddingLeft="#dimen/slide_title">
<RelativeLayout
android:id="#+id/be_details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<TextView
android:id="#+id/be_year"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2016"
android:textSize="#dimen/slide_title"
android:textStyle="bold" />
<TextView
android:id="#+id/college"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#+id/be_year"
android:text="SKIT,Banglore"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/course"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/college"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#+id/be_year"
android:text="#string/course_detail"
android:textColor="#color/lighter"
android:textSize="20sp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/th12_detail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/be_details"
android:layout_marginTop="#dimen/slide_title">
<TextView
android:id="#+id/th12_year"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2012"
android:textSize="#dimen/slide_title"
android:textStyle="bold" />
<TextView
android:id="#+id/th12_college"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#+id/th12_year"
android:text="SLIC,Rampur"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/th12_course"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/th12_college"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#id/th12_year"
android:text="#string/th12_details"
android:textColor="#color/lighter"
android:textSize="20sp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/school_detail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/th12_detail"
android:layout_marginTop="#dimen/slide_title">
<TextView
android:id="#+id/scl_year"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2010"
android:textSize="#dimen/slide_title"
android:textStyle="bold" />
<TextView
android:id="#+id/scl_school"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#+id/scl_year"
android:text="SRHS,Tanda"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/scl_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/scl_school"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#id/scl_year"
android:text="#string/school_details"
android:textColor="#color/lighter"
android:textSize="20sp" />
</RelativeLayout>
</RelativeLayout>
</ScrollView>
where am doing wrong?
Remove android:layout_marginBottom="#dimen/slide_title" and android:layout_marginTop="#dimen/slide_title"from first RelativeLayout after ScrollView and it will work
The only things to be done for the solution just add a nested scroll view within the scrollview here is the working code :
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/slide_title"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="#dimen/slide_title"
android:background="#color/Blue"
android:paddingLeft="#dimen/slide_title">
<RelativeLayout
android:id="#+id/be_details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<TextView
android:id="#+id/be_year"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2016"
android:textSize="#dimen/slide_title"
android:textStyle="bold" />
<TextView
android:id="#+id/college"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#+id/be_year"
android:text="SKIT,Banglore"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/course"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/college"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#+id/be_year"
android:text="#string/course_detail"
android:textColor="#color/lighter"
android:textSize="20sp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/th12_detail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/be_details"
android:layout_marginTop="#dimen/slide_title">
<TextView
android:id="#+id/th12_year"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2012"
android:textSize="#dimen/slide_title"
android:textStyle="bold" />
<TextView
android:id="#+id/th12_college"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#+id/th12_year"
android:text="SLIC,Rampur"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/th12_course"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/th12_college"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#id/th12_year"
android:text="#string/th12_details"
android:textColor="#color/lighter"
android:textSize="20sp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/school_detail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/th12_detail"
android:layout_marginTop="#dimen/slide_title">
<TextView
android:id="#+id/scl_year"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2010"
android:textSize="#dimen/slide_title"
android:textStyle="bold" />
<TextView
android:id="#+id/scl_school"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#+id/scl_year"
android:text="SRHS,Tanda"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/scl_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/scl_school"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#id/scl_year"
android:text="#string/school_details"
android:textColor="#color/lighter"
android:textSize="20sp" />
</RelativeLayout>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
</ScrollView>
I used 20 spinners and 40 textviews for displaying the name poster. When I edit this xml resource file Android Studio showing popup is Out of memory error
Here is the popup
I incresed the xmx size to 2048.
Eventhogh it showing same error when I open that xml file. here I put the xml 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:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/adViewContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.85">
<RelativeLayout
android:id="#+id/relNameLayout"
android:layout_width="match_parent"
android:layout_height="fill_parent">
<TextView
android:id="#+id/spinner"
android:layout_width="70dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="18dp"
android:layout_marginStart="18dp"
android:layout_marginTop="15dp"
android:gravity="right"
android:textColor="#ff0000"
android:visibility="invisible" />
<Spinner
android:id="#+id/spinner2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/spinner"
android:layout_marginLeft="25dp"
android:layout_marginStart="25dp"
android:layout_toRightOf="#+id/spinner"
android:visibility="invisible" />
<TextView
android:id="#+id/txtSpinner2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/spinner3"
android:layout_alignTop="#+id/spinner"
android:layout_marginLeft="25dp"
android:layout_marginStart="25dp"
android:layout_toRightOf="#+id/spinner"
android:gravity="left"
android:textColor="#0287FC"
android:visibility="invisible" />
<TextView
android:id="#+id/spinner3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/spinner"
android:layout_alignLeft="#+id/spinner"
android:layout_alignRight="#+id/spinner"
android:layout_alignStart="#+id/spinner"
android:layout_below="#+id/spinner"
android:layout_marginTop="6dp"
android:gravity="right"
android:textColor="#ff0000"
android:visibility="invisible" />
<Spinner
android:id="#+id/spinner4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner2"
android:layout_alignStart="#+id/spinner2"
android:layout_alignTop="#+id/spinner3"
android:visibility="invisible" />
<TextView
android:id="#+id/txtSpinner4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/spinner5"
android:layout_alignLeft="#+id/spinner4"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignStart="#+id/spinner4"
android:layout_alignTop="#+id/spinner4"
android:gravity="left"
android:textColor="#0287FC"
android:visibility="invisible" />
<TextView
android:id="#+id/spinner5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/spinner3"
android:layout_alignLeft="#+id/spinner3"
android:layout_alignRight="#+id/spinner3"
android:layout_alignStart="#+id/spinner3"
android:layout_below="#+id/spinner3"
android:layout_marginTop="6dp"
android:gravity="right"
android:textColor="#ff0000"
android:visibility="invisible" />
<Spinner
android:id="#+id/spinner6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner4"
android:layout_alignStart="#+id/spinner4"
android:layout_alignTop="#+id/spinner5"
android:visibility="invisible" />
<TextView
android:id="#+id/txtSpinner6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/spinner7"
android:layout_alignLeft="#+id/spinner6"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignStart="#+id/spinner6"
android:layout_alignTop="#+id/spinner6"
android:gravity="left"
android:textColor="#0287FC"
android:visibility="invisible" />
<TextView
android:id="#+id/spinner7"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/spinner5"
android:layout_alignLeft="#+id/spinner5"
android:layout_alignRight="#+id/spinner5"
android:layout_alignStart="#+id/spinner5"
android:layout_below="#+id/spinner5"
android:layout_marginTop="6dp"
android:gravity="right"
android:textColor="#ff0000"
android:visibility="invisible" />
<Spinner
android:id="#+id/spinner8"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner6"
android:layout_alignStart="#+id/spinner6"
android:layout_alignTop="#+id/spinner7"
android:visibility="invisible" />
<TextView
android:id="#+id/txtSpinner8"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/spinner9"
android:layout_alignLeft="#+id/spinner6"
android:layout_alignStart="#+id/spinner6"
android:layout_alignTop="#+id/spinner7"
android:gravity="left"
android:textColor="#0287FC"
android:visibility="invisible" />
<TextView
android:id="#+id/spinner9"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/spinner7"
android:layout_alignLeft="#+id/spinner7"
android:layout_alignRight="#+id/spinner7"
android:layout_alignStart="#+id/spinner7"
android:layout_below="#+id/spinner7"
android:layout_marginTop="6dp"
android:gravity="right"
android:textColor="#ff0000"
android:visibility="invisible" />
<Spinner
android:id="#+id/spinner10"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner8"
android:layout_alignStart="#+id/spinner8"
android:layout_alignTop="#+id/spinner9"
android:visibility="invisible" />
<TextView
android:id="#+id/txtSpinner10"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/spinner11"
android:layout_alignLeft="#+id/spinner8"
android:layout_alignStart="#+id/spinner8"
android:layout_alignTop="#+id/spinner9"
android:gravity="left"
android:textColor="#0287FC"
android:visibility="invisible" />
<TextView
android:id="#+id/spinner11"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/spinner9"
android:layout_alignLeft="#+id/spinner9"
android:layout_alignRight="#+id/spinner9"
android:layout_alignStart="#+id/spinner9"
android:layout_below="#+id/spinner9"
android:layout_marginTop="6dp"
android:gravity="right"
android:textColor="#ff0000"
android:visibility="invisible" />
<Spinner
android:id="#+id/spinner12"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner10"
android:layout_alignStart="#+id/spinner10"
android:layout_alignTop="#+id/spinner11"
android:visibility="invisible" />
<TextView
android:id="#+id/txtSpinner12"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/spinner13"
android:layout_alignLeft="#+id/spinner12"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignStart="#+id/spinner12"
android:layout_alignTop="#+id/spinner12"
android:gravity="left"
android:textColor="#0287FC"
android:visibility="invisible" />
<TextView
android:id="#+id/spinner13"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/spinner11"
android:layout_alignLeft="#+id/spinner11"
android:layout_alignRight="#+id/spinner11"
android:layout_alignStart="#+id/spinner11"
android:layout_below="#+id/spinner11"
android:layout_marginTop="6dp"
android:gravity="right"
android:textColor="#ff0000"
android:visibility="invisible" />
<Spinner
android:id="#+id/spinner14"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner12"
android:layout_alignStart="#+id/spinner12"
android:layout_alignTop="#+id/spinner13"
android:visibility="invisible" />
<TextView
android:id="#+id/txtSpinner14"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/spinner15"
android:layout_alignLeft="#+id/spinner12"
android:layout_alignStart="#+id/spinner12"
android:layout_alignTop="#+id/spinner13"
android:gravity="left"
android:textColor="#0287FC"
android:visibility="invisible" />
<TextView
android:id="#+id/spinner15"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/spinner13"
android:layout_alignLeft="#+id/spinner13"
android:layout_alignRight="#+id/spinner13"
android:layout_alignStart="#+id/spinner13"
android:layout_below="#+id/spinner13"
android:layout_marginTop="6dp"
android:gravity="right"
android:textColor="#ff0000"
android:visibility="invisible" />
<Spinner
android:id="#+id/spinner16"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner14"
android:layout_alignStart="#+id/spinner14"
android:layout_alignTop="#+id/spinner15"
android:visibility="invisible" />
<TextView
android:id="#+id/txtSpinner16"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner14"
android:layout_alignStart="#+id/spinner14"
android:layout_alignTop="#+id/spinner15"
android:textColor="#0287FC"
android:visibility="invisible" />
<TextView
android:id="#+id/spinner17"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/spinner15"
android:layout_alignLeft="#+id/spinner15"
android:layout_alignRight="#+id/spinner15"
android:layout_alignStart="#+id/spinner15"
android:layout_below="#+id/spinner15"
android:layout_marginTop="6dp"
android:gravity="right"
android:textColor="#ff0000"
android:visibility="invisible" />
<Spinner
android:id="#+id/spinner18"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner16"
android:layout_alignStart="#+id/spinner16"
android:layout_alignTop="#+id/spinner17"
android:layout_below="#+id/spinner16"
android:visibility="invisible" />
<TextView
android:id="#+id/txtSpinner18"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner16"
android:layout_alignStart="#+id/spinner16"
android:layout_alignTop="#+id/spinner17"
android:layout_below="#+id/txtSpinner16"
android:gravity="left"
android:textColor="#0287FC"
android:visibility="invisible" />
<TextView
android:id="#+id/spinner19"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/spinner17"
android:layout_alignLeft="#+id/spinner17"
android:layout_alignRight="#+id/spinner17"
android:layout_alignStart="#+id/spinner17"
android:layout_below="#+id/spinner17"
android:layout_marginTop="6dp"
android:gravity="right"
android:textColor="#ff0000"
android:visibility="invisible" />
<Spinner
android:id="#+id/spinner20"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner18"
android:layout_alignStart="#+id/spinner18"
android:layout_alignTop="#+id/spinner19"
android:layout_below="#+id/spinner18"
android:visibility="invisible" />
<TextView
android:id="#+id/txtSpinner20"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner18"
android:layout_alignStart="#+id/spinner18"
android:layout_alignTop="#+id/spinner19"
android:layout_below="#+id/txtSpinner18"
android:gravity="left"
android:textColor="#0287FC"
android:visibility="invisible" />
<TextView
android:id="#+id/spinner21"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/spinner19"
android:layout_alignLeft="#+id/spinner19"
android:layout_alignRight="#+id/spinner19"
android:layout_alignStart="#+id/spinner19"
android:layout_below="#+id/spinner19"
android:layout_marginTop="6dp"
android:gravity="right"
android:textColor="#ff0000"
android:visibility="invisible" />
<Spinner
android:id="#+id/spinner22"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner20"
android:layout_alignStart="#+id/spinner20"
android:layout_alignTop="#+id/spinner21"
android:layout_below="#+id/spinner20"
android:visibility="invisible" />
<TextView
android:id="#+id/txtSpinner22"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner20"
android:layout_alignStart="#+id/spinner20"
android:layout_alignTop="#+id/spinner21"
android:layout_below="#+id/txtSpinner20"
android:gravity="left"
android:textColor="#0287FC"
android:visibility="invisible" />
<TextView
android:id="#+id/spinner23"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/spinner21"
android:layout_alignLeft="#+id/spinner21"
android:layout_alignRight="#+id/spinner21"
android:layout_alignStart="#+id/spinner21"
android:layout_below="#+id/spinner21"
android:layout_marginTop="6dp"
android:gravity="right"
android:textColor="#ff0000"
android:visibility="invisible" />
<Spinner
android:id="#+id/spinner24"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner22"
android:layout_alignStart="#+id/spinner22"
android:layout_alignTop="#+id/spinner23"
android:layout_below="#+id/spinner22"
android:visibility="invisible" />
<TextView
android:id="#+id/txtSpinner24"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner22"
android:layout_alignStart="#+id/spinner22"
android:layout_alignTop="#+id/spinner23"
android:layout_below="#+id/txtSpinner22"
android:gravity="left"
android:textColor="#0287FC"
android:visibility="invisible" />
<TextView
android:id="#+id/spinner25"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/spinner23"
android:layout_alignLeft="#+id/spinner23"
android:layout_alignRight="#+id/spinner23"
android:layout_alignStart="#+id/spinner23"
android:layout_below="#+id/spinner23"
android:layout_marginTop="6dp"
android:gravity="right"
android:textColor="#ff0000"
android:visibility="invisible" />
<Spinner
android:id="#+id/spinner26"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner24"
android:layout_alignStart="#+id/spinner24"
android:layout_alignTop="#+id/spinner25"
android:layout_below="#+id/spinner24"
android:visibility="invisible" />
<TextView
android:id="#+id/txtSpinner26"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner24"
android:layout_alignStart="#+id/spinner24"
android:layout_alignTop="#+id/spinner25"
android:layout_below="#+id/txtSpinner24"
android:gravity="left"
android:textColor="#0287FC"
android:visibility="invisible" />
<TextView
android:id="#+id/spinner27"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/spinner25"
android:layout_alignLeft="#+id/spinner25"
android:layout_alignRight="#+id/spinner25"
android:layout_alignStart="#+id/spinner25"
android:layout_below="#+id/spinner25"
android:layout_marginTop="6dp"
android:gravity="right"
android:textColor="#ff0000"
android:visibility="invisible" />
<Spinner
android:id="#+id/spinner28"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner26"
android:layout_alignStart="#+id/spinner26"
android:layout_alignTop="#+id/spinner27"
android:layout_below="#+id/spinner26"
android:visibility="invisible" />
<TextView
android:id="#+id/txtSpinner28"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner26"
android:layout_alignStart="#+id/spinner26"
android:layout_alignTop="#+id/spinner27"
android:layout_below="#+id/txtSpinner26"
android:gravity="left"
android:textColor="#0287FC"
android:visibility="invisible" />
<TextView
android:id="#+id/spinner29"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/spinner27"
android:layout_alignLeft="#+id/spinner27"
android:layout_alignRight="#+id/spinner27"
android:layout_alignStart="#+id/spinner27"
android:layout_below="#+id/spinner27"
android:layout_marginTop="6dp"
android:gravity="right"
android:textColor="#ff0000"
android:visibility="invisible" />
<Spinner
android:id="#+id/spinner30"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/spinner28"
android:layout_alignStart="#+id/spinner28"
android:layout_alignTop="#+id/spinner29"
android:layout_below="#+id/spinner28"
android:visibility="invisible" />
.........
..........
.........
</RelativeLayout>
</ScrollView>
I used 20 spinners and 40 textviews layout to display a poster as following shown. Is there any other way to get that please do let me know.
My poster
I was fighting with this problem today for a few hours and ended up trying File -> Invalidate Caches / Restart... and chose the Invalidate/Restart option. Seems to have fixed the Out of Memory error.
Don't know if that will work for you at a later time, but hopefully it helps.
XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="#layout/toolbar"/>
<ScrollView
android:id="#+id/scroll"
android:layout_width="wrap_content"
android:layout_below="#+id/toolbar"
android:layout_height="wrap_content"
android:layout_above="#+id/makeOffer"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:id="#+id/firstcard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/padding_8dp"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp"
android:layout_marginTop="#dimen/padding_8dp"
app:cardCornerRadius="#dimen/padding_4dp">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp">
<RelativeLayout
android:id="#+id/insidecardone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_margin="#dimen/padding_4dp">
<TextView
android:id="#+id/constant_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/padding_4dp"
android:text="Charge per day"
android:textSize="#dimen/text_size_big_16" />
<EditText
android:id="#+id/tvRentPerday"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:hint="Rs. "
android:gravity="center"
android:inputType="number"
android:maxLength="4"
android:textColor="#android:color/black"
android:textSize="#dimen/text_size_big_16" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/insidecardtwo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/insidecardone"
android:layout_margin="#dimen/padding_4dp">
<TextView
android:id="#+id/con_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="Duration (Days)"
android:textSize="#dimen/text_size_big_16" />
<TextView
android:id="#+id/num_days"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:gravity="center_horizontal"
android:paddingEnd="#dimen/padding_16dp"
android:paddingRight="#dimen/padding_24dp"
android:text="10"
android:textSize="#dimen/text_size_big_16"
/>
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/insidecardtwo"
android:layout_margin="#dimen/padding_8dp"
android:background="#color/grey_lighter" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/insidecardtwo"
android:layout_margin="#dimen/padding_4dp"
android:paddingBottom="#dimen/padding_8dp"
android:paddingTop="#dimen/padding_24dp">
<TextView
android:id="#+id/total_constant"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="#dimen/padding_4dp"
android:gravity="center_vertical"
android:text="Total Amount"
android:textSize="#dimen/text_size_big_16" />
<TextView
android:id="#+id/tvAmount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:gravity="center_vertical"
android:textColor="#ff4f00"
android:textSize="#dimen/text_size_big_16"
android:textStyle="bold" />
<TextView
android:id="#+id/total_constant_mutterfly"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/total_constant"
android:paddingTop="#dimen/padding_4dp"
android:text="#string/process_fee_text"
android:textColor="#android:color/darker_gray"
android:textSize="8sp" />
</RelativeLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="#+id/middlecard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/firstcard"
android:layout_marginBottom="#dimen/padding_8dp"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp"
app:cardCornerRadius="#dimen/padding_4dp">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/padding_8dp"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp">
<RelativeLayout
android:id="#+id/middlecard_relative"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_margin="#dimen/padding_4dp">
<TextView
android:id="#+id/deposite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="#dimen/padding_4dp"
android:gravity="center_vertical"
android:text="Deposit"
android:textSize="#dimen/text_size_big_16" />
<TextView
android:id="#+id/knowmore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/deposite"
android:text="#string/txt_know_more"
android:layout_marginTop="#dimen/padding_8dp"
android:textSize="#dimen/text_size_extra_extra_small_10"
/>
<CheckBox
android:id="#+id/checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:inputType="number"
android:paddingEnd="#dimen/padding_16dp"
android:paddingRight="#dimen/padding_16dp"
android:textColor="#android:color/black"
android:textSize="#dimen/text_size_big_16" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/middletwo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/middlecard_relative"
android:layout_margin="#dimen/padding_4dp"
android:visibility="gone"
>
<TextView
android:id="#+id/middle_con_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="Charge (Rs.)"
android:textSize="#dimen/text_size_big_16" />
<EditText
android:id="#+id/etDeposit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:gravity="center"
android:paddingEnd="#dimen/padding_16dp"
android:paddingRight="#dimen/padding_16dp"
android:hint="1000"
android:maxLength="4"
android:inputType="number"
android:textSize="#dimen/text_size_big_16"
/>
</RelativeLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="#+id/seccard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/middlecard"
android:layout_marginBottom="#dimen/padding_8dp"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp"
app:cardCornerRadius="#dimen/padding_4dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:id="#+id/describe_constant_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="#dimen/padding_8dp"
android:text="Describe Your item"
android:textColor="#ff4f00"
android:textStyle="bold" />
<RelativeLayout
android:id="#+id/rlTohide"
android:layout_marginTop="#dimen/padding_4dp"
android:layout_width="160dp"
android:layout_height="120dp"
android:background="#drawable/greyborder_transparentbg"
>
<ImageView
android:id="#+id/img1"
android:layout_centerInParent="true"
android:layout_width="40dp"
android:src="#drawable/addimg"
android:layout_height="40dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/img1"
android:text="(Optional)"
android:textSize="#dimen/text_size_extra_extra_small_10"
android:textColor="#color/text_grey_opc"
android:layout_centerInParent="true"
/>
</RelativeLayout>
<ImageView
android:visibility="gone"
android:id="#+id/imgResource"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_gravity="center"
android:layout_marginTop="#dimen/padding_8dp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp"
android:layout_marginTop="180dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/insidecardone"
android:layout_margin="#dimen/padding_4dp"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp">
<TextView
android:id="#+id/con_product_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="8dp"
android:text="Name Of Product"
android:textSize="#dimen/text_size_big_16" />
<EditText
android:id="#+id/product_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_toEndOf="#+id/con_product_name"
android:layout_toRightOf="#+id/con_product_name"
android:layout_alignParentRight="true"
android:hint="E.g. Nikon DSLR"
android:paddingEnd="#dimen/padding_16dp"
android:paddingRight="#dimen/padding_16dp"
android:maxLength="30"
android:inputType="textPersonName"
android:layout_marginLeft="#dimen/padding_16dp"
android:layout_marginStart="#dimen/padding_16dp"
android:textColor="#android:color/black"
android:textSize="#dimen/text_size_big_16"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/insidecardtwo"
android:layout_margin="#dimen/padding_4dp"
android:layout_marginBottom="#dimen/padding_8dp"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp">
<TextView
android:id="#+id/Description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="Description :"
android:textSize="#dimen/text_size_big_16" />
<EditText
android:id="#+id/desc_box"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/Description"
android:hint="E.g. Comes with 18-55 mm lens, charger and carry case"
android:layout_marginTop="#dimen/padding_8dp"
android:background="#drawable/white_border_request_screen"
android:textColor="#android:color/darker_gray"
android:textSize="#dimen/text_size_big_16" />
</RelativeLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>
</ScrollView>
<Button
android:id="#+id/makeOffer"
android:layout_width="match_parent"
android:layout_height="#dimen/padding_48dp"
android:layout_alignParentBottom="true"
android:background="#color/new_primary_text"
android:padding="#dimen/padding_8dp"
android:text="#string/txt_make_offr"
android:textColor="#android:color/white"
android:textSize="#dimen/text_size_18"
/>
</RelativeLayout>
Android Manifest
<activity
android:name=".MyActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"/>
I am working on the layout since last night and I tried almost solution which I known. I am new in Android so please suggest me what is wrong with this layout.
this "fillViewport" work for another screen but with this screen it's not working.
Add android:windowSoftInputMode="stateHidden|adjustResize" to your <activity> tag in AndroidManifest.xml file. This will cause the screen to be resized to the left over space after the soft keyboard is shown. So, you will be able to scroll easily.
One more thing set property of ScrollView to the android:layout_above to the Button on the bottom of the page.
UpDate :
add this line to your ScrollView.
android:layout_above="#+id/makeOffer"
like this way
<ScrollView
android:id="#+id/scroll"
android:layout_width="wrap_content"
android:layout_below="#+id/toolbar"
android:layout_height="wrap_content"
android:fillViewport="true"
android:layout_above="#+id/makeOffer">
ScreenShot :
I am trying to make my layout Scrollable by adding ScrollView as an parent for my Relative Layout.But my layout not scrolled.I have added the fillport property to true.
Here is my xml file:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/scrollView2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="#+id/repActivityTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:ellipsize="middle"
android:textSize="18sp"
android:background="#android:color/darker_gray"
android:text="#string/representativeTitle" />
<TextView
android:id="#+id/repStreet"
android:layout_width="100dip"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/repImage"
android:layout_marginTop="14sp"
android:layout_toRightOf="#+id/repImage"
android:layout_margin="3sp"
android:text="#string/repStreet" />
<TextView
android:id="#+id/repState"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/repStreet"
android:layout_toRightOf="#+id/repImage"
android:text="#string/repState" />
<TextView
android:id="#+id/repCountry"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/repState"
android:layout_below="#+id/repState"
android:text="#string/repCountry" />
<com.google.android.maps.MapView
android:id="#+id/repMap"
android:layout_width="100dip"
android:layout_height="100dip"
android:paddingTop="2dp"
android:layout_marginTop="2dp"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/repImage"
android:apiKey="0lsQmtr2D241pSL53j0vQ2lYUs4_ZIWkIHyHAKw" >
</com.google.android.maps.MapView>
<View
android:id="#+id/firstHorizontalLine"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_alignParentLeft="true"
android:layout_below="#+id/repMap"
android:layout_marginTop="54dp"
android:background="#android:color/black" />
<TextView
android:id="#+id/issues2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/issues1"
android:layout_centerVertical="true"
android:text="#string/issues2" />
<View
android:id="#+id/secondHorizontalLine"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_alignParentLeft="true"
android:layout_below="#+id/accomplishments"
android:background="#android:color/black" />
<TextView
android:id="#+id/issues"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_alignBottom="#+id/firstHorizontalLine"
android:layout_alignRight="#+id/repStreet"
android:text="#string/issues" />
<TextView
android:id="#+id/accomplish2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/accomplish1"
android:layout_below="#+id/accomplish1"
android:layout_marginTop="18dp"
android:text="#string/accomplishments2" />
<TextView
android:id="#+id/promises"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/issues"
android:gravity="center"
android:layout_below="#+id/accomplish2"
android:text="#string/promises" />
<View
android:id="#+id/thirdHorizontalLine"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/black"
android:layout_alignParentLeft="true"
android:layout_below="#+id/promises" />
<TextView
android:id="#+id/accomplishments"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/issues2"
android:gravity="center"
android:layout_toLeftOf="#+id/repMap"
android:text="#string/accomplishments" />
<TextView
android:id="#+id/accomplish1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/secondHorizontalLine"
android:layout_marginTop="21dp"
android:text="#string/accomplishments1" />
<TextView
android:id="#+id/issues1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/issues2"
android:layout_alignParentLeft="true"
android:layout_marginBottom="14dp"
android:text="#string/issues1" />
<ImageView
android:id="#+id/repImage"
android:layout_width="100dip"
android:layout_height="100dip"
android:layout_alignParentLeft="true"
android:layout_below="#+id/repActivityTitle"
android:contentDescription="#string/representativeImage"
android:paddingTop="2dp"
android:layout_marginTop="2dp"
android:scaleType="centerCrop"
android:src="#drawable/icon" />
<TextView
android:id="#+id/promise1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/thirdHorizontalLine"
android:layout_marginTop="19dp"
android:text="#string/promises1" />
<TextView
android:id="#+id/promise2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/promise1"
android:text="#string/promises2" />
</RelativeLayout>
</ScrollView>
Here I have used the ScrollView but the full content of layout is not as showing.As scrolls not work here.
Try to remove this line and check
android:fillViewport="true"
And also you can try height of relativelayout to match_parent instead of wrap_content
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>