I developed an Tabs android application in which the scroll-view is not scrolling.. I am posting the code here please check and if found any error please help.. Here I used ScrollView as root and then LinearLayout... but this is not scrolling at the end (stop at half of label name:"label_h_total")
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center|top"
android:orientation="vertical"
android:background="#color/colorPrimary"
>
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:id="#+id/arrowImageView"
android:src="#drawable/logo_grey"
/>
<TextView
android:id="#+id/NameTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="20dp"
android:textStyle="bold"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<TextView
android:id="#+id/dTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<TextView
android:id="#+id/positionTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<TextView
android:id="#+id/IdTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_id"
android:textSize="15dp"
android:layout_marginBottom="#dimen/activity_vertical_margin"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<!--items-->
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#android:color/white"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/image1"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:src="#drawable/takeoff_color"
android:layout_alignParentStart="true"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_b"
android:textSize="15dp"
android:layout_toEndOf="#id/image1"
android:textStyle="bold"
android:textColor="#color/colorPrimary" />
<TextView
android:id="#+id/sTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#color/colorPrimary" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/image2"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/document"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_date"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#id/image2"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/DateTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#android:color/white" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#android:color/white"
android:paddingTop="10dp"
android:paddingBottom="10dp"
>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/image3"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/document_color"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_end_of"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#id/image3"
android:textColor="#color/colorPrimary" />
<TextView
android:id="#+id/endOfTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:gravity="start"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#color/colorPrimary" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/imageView"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/ic_action_money"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_c"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#+id/imageView"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/currentSalaryTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#android:color/white" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#android:color/white"
android:paddingTop="10dp"
android:paddingBottom="10dp"
>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/imageView2"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/bag_color"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_h_total"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#+id/imageView2"
android:textColor="#color/colorPrimary" />
<TextView
android:id="#+id/salaryTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#color/colorPrimary" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp"
>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/imageView3"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/purchase_order"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_g"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#+id/imageView3"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/gTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#android:color/white" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
XML tabs:
<android.support.design.widget.CoordinatorLayout 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">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light" />
<android.support.design.widget.TabLayout
android:id="#+id/tabs"
android:layout_width="match_parent"
android:layout_height="#dimen/custom_tab_layout_height"
app:tabMode="fixed"
app:tabGravity="fill"/>
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="#+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
Related
I am trying to use horizontal scrollview inside a scroll view. My parent scroll isn't scrolling smoothly. Although my child scroll is scrolling smoothly, I want to achieve smooth scrolling of parent scroll. I have tried every method, I have in my mind setting HardwareAccelerated to false worked but it removed elevation from my views.
Main Activity
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ECEFF1"
android:clipToPadding="false">
<RelativeLayout
android:layout_width="250dp"
android:layout_height="90dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginLeft="75dp"
android:layout_marginTop="100dp"
android:background="#drawable/round_corners"
android:clipToPadding="false"
android:elevation="5dp"
android:translationZ="5dp"
tools:layout_editor_absoluteX="42dp"
tools:layout_editor_absoluteY="121dp">
<ImageView
android:id="#+id/enquiry"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_alignParentEnd="true"
android:layout_alignTop="#+id/visa"
android:layout_marginEnd="35dp"
app:srcCompat="#drawable/phone" />
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignTop="#+id/textView2"
android:layout_marginEnd="20dp"
android:text="Enquiry"
android:textColor="#color/navigationBarColor"
android:textSize="15sp" />
<ImageView
android:id="#+id/visa"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_alignTop="#+id/holidays"
android:layout_centerHorizontal="true"
app:srcCompat="#drawable/globe" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/textView3"
android:layout_centerHorizontal="true"
android:text="Visa"
android:textColor="#android:color/background_dark"
android:textSize="15sp" />
<ImageView
android:id="#+id/holidays"
android:layout_width="25dp"
android:layout_height="32dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="35dp"
android:layout_marginTop="18dp"
app:srcCompat="#drawable/plane" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="14dp"
android:layout_marginStart="20dp"
android:text="Holidays"
android:textColor="#android:color/background_dark" />
</RelativeLayout>
<include
android:id="#+id/toolbar"
layout="#layout/app_bar" />
<Button
android:id="#+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="false"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:background="#color/colorPrimary"
android:fontFamily="serif"
android:text="Call"
android:textColor="#color/textColorPrimary"
android:textSize="20sp" />
<ScrollView
android:id="#+id/parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="200dp"
android:scrollbars="none">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="30dp"
android:orientation="vertical">
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="0dp"
android:layout_marginLeft="25dp"
android:layout_marginTop="50dp"
android:text="Pilgrimage"
android:textColor="#android:color/background_dark"
android:textSize="25sp"
android:textStyle="bold" />
<android.support.v7.widget.CardView
android:id="#+id/pilg"
class="com.example.admin.myapplication.Pilgrimage"
android:layout_width="320dp"
android:layout_height="240dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginLeft="25dp"
android:layout_marginTop="20dp"
android:background="#drawable/round_corners"
android:elevation="5dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="#drawable/hu" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="100dp"
android:layout_marginTop="155dp"
android:fontFamily="serif"
android:text="Hajj And Umrah"
android:textColor="#color/navigationBarColor"
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="190dp"
android:text="Ramzan Umrah"
android:textColor="#color/colorPrimaryDark"
android:textSize="12sp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="210dp"
android:layout_marginTop="190dp"
android:text="29 Days/30 Nights"
android:textColor="#color/colorPrimaryDark"
android:textSize="12sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="205dp"
android:text="Starts From Rs.65,000/-"
android:textColor="#color/colorPrimaryDark"
android:textSize="12sp" />
</android.support.v7.widget.CardView>
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginTop="25dp"
android:text="Holiday Packages"
android:textColor="#color/navigationBarColor"
android:textSize="25sp"
android:textStyle="bold" />
<HorizontalScrollView
android:id="#+id/child"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<RelativeLayout
android:id="#+id/international"
class="com.example.admin.myapplication.International"
android:layout_width="200dp"
android:layout_height="225dp"
android:layout_marginBottom="30dp"
android:layout_marginLeft="25dp"
android:layout_marginTop="20dp"
android:background="#mipmap/ll"
android:elevation="5dp"
android:padding="-25dp">
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="11dp"
android:fontFamily="serif"
android:text="International"
android:textColor="#color/textColorPrimary"
android:textSize="20sp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/dom1"
android:layout_width="200dp"
android:layout_height="225dp"
android:layout_marginBottom="30dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="25dp"
android:layout_marginTop="20dp"
android:background="#mipmap/rajasthan"
android:elevation="5dp">
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="12dp"
android:fontFamily="serif"
android:text="Domestic"
android:textColor="#color/textColorPrimary"
android:textSize="20sp" />
</RelativeLayout>
</LinearLayout>
</HorizontalScrollView>
<TextView
android:id="#+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="30dp"
android:layout_marginLeft="25dp"
android:layout_marginTop="25dp"
android:text="Social"
android:textColor="#color/navigationBarColor"
android:textSize="25sp" />
<LinearLayout
android:layout_width="335dp"
android:layout_height="50dp"
android:layout_marginBottom="100dp"
android:layout_marginLeft="25dp"
android:orientation="horizontal">
</LinearLayout>
</LinearLayout>
</ScrollView>
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="14dp"
android:fontFamily="serif"
android:text="Al Shariq Enterprises"
android:textColor="#color/textColorPrimary"
android:textSize="20sp"
android:textStyle="bold" />
</RelativeLayout>
Try this NestedScrollView like this :-
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="200dp">
<android.support.v4.widget.NestedScrollView
android:id="#+id/parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="30dp"
android:orientation="vertical">
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="0dp"
android:layout_marginLeft="25dp"
android:layout_marginTop="50dp"
android:text="Pilgrimage"
android:textColor="#android:color/background_dark"
android:textSize="25sp"
android:textStyle="bold" />
<android.support.v7.widget.CardView
android:id="#+id/pilg"
class="com.example.admin.myapplication.Pilgrimage"
android:layout_width="320dp"
android:layout_height="240dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginLeft="25dp"
android:layout_marginTop="20dp"
android:background="#drawable/round_corners"
android:elevation="5dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="#drawable/hu" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="100dp"
android:layout_marginTop="155dp"
android:fontFamily="serif"
android:text="Hajj And Umrah"
android:textColor="#color/navigationBarColor"
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="190dp"
android:text="Ramzan Umrah"
android:textColor="#color/colorPrimaryDark"
android:textSize="12sp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="210dp"
android:layout_marginTop="190dp"
android:text="29 Days/30 Nights"
android:textColor="#color/colorPrimaryDark"
android:textSize="12sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="205dp"
android:text="Starts From Rs.65,000/-"
android:textColor="#color/colorPrimaryDark"
android:textSize="12sp" />
</android.support.v7.widget.CardView>
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginTop="25dp"
android:text="Holiday Packages"
android:textColor="#color/navigationBarColor"
android:textSize="25sp"
android:textStyle="bold" />
<HorizontalScrollView
android:id="#+id/child"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<RelativeLayout
android:id="#+id/international"
class="com.example.admin.myapplication.International"
android:layout_width="200dp"
android:layout_height="225dp"
android:layout_marginBottom="30dp"
android:layout_marginLeft="25dp"
android:layout_marginTop="20dp"
android:background="#mipmap/ll"
android:elevation="5dp"
android:padding="-25dp">
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="11dp"
android:fontFamily="serif"
android:text="International"
android:textColor="#color/textColorPrimary"
android:textSize="20sp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/dom1"
android:layout_width="200dp"
android:layout_height="225dp"
android:layout_marginBottom="30dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="25dp"
android:layout_marginTop="20dp"
android:background="#mipmap/rajasthan"
android:elevation="5dp">
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="12dp"
android:fontFamily="serif"
android:text="Domestic"
android:textColor="#color/textColorPrimary"
android:textSize="20sp" />
</RelativeLayout>
</LinearLayout>
</HorizontalScrollView>
<TextView
android:id="#+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="30dp"
android:layout_marginLeft="25dp"
android:layout_marginTop="25dp"
android:text="Social"
android:textColor="#color/navigationBarColor"
android:textSize="25sp" />
<LinearLayout
android:layout_width="335dp"
android:layout_height="50dp"
android:layout_marginBottom="100dp"
android:layout_marginLeft="25dp"
android:orientation="horizontal">
</LinearLayout>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</LinearLayout>
For basic details you can check this link.
I think that this happens because both of your ScrollViews reacts to scrolling so it seems to you that it lags, but it actually don't, its just vertical ScrollView interrupting horizontal ScrollView.
It is not recommended using ScrollView inside another ScrollView. Instead use NestedScrollView as in this answer.
I want to scroll recyclerview with dyanmic position for that i have used below layout but when i am set dynamic position in recyclerview. it is scroll but not above appbar layout.
So how to scroll both recyclerview and appbarlayout when set dynamic position using .
Is it possible parralel scroll if i will set dyamic position.
new Handler().postDelayed(new Runnable() {
#Override
public void run() {
rclTrendDetail.smoothScrollToPosition (3);
}
}, 2000);
<?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"
xmlns:fbutton="http://schemas.android.com/tools"
>
<android.support.design.widget.CoordinatorLayout
android:id="#+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/relativeTop"
android:background="#color/colorWhite"
android:padding="0dp"
>
<android.support.design.widget.AppBarLayout
android:id="#+id/appbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorWhite"
>
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/collapsingLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorWhite"
app:contentScrim="#color/colorTransparent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorWhite"
android:orientation="vertical"
>
<RelativeLayout
android:id="#+id/relativeProfile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorWhite"
>
<RelativeLayout
android:id="#+id/relativeVideo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorWhite"
android:visibility="gone"
>
<com.malmstein.fenster.view.FensterVideoView
android:id="#+id/videoplayer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
/>
<LinearLayout
android:id="#+id/linearPlay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#drawable/round_button_progress_bar"
android:gravity="center"
android:orientation="vertical"
>
<ImageView
android:id="#+id/imgShadow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:layout_marginTop="15dp"
android:src="#drawable/ic_play"
/>
</LinearLayout>
<com.spoof.app.customcontrol.CustomButtonRegular
android:id="#+id/gobbleVdoTxt"
style="#style/MyCustomButton"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="25dp"
android:background="#drawable/round_button_progress_bar"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:textAllCaps="false"
android:textColor="#color/colorWhite"
android:textSize="12sp"
android:textStyle="normal"
android:visibility="gone"
/>
<RelativeLayout
android:id="#+id/relativeVideoTime"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="20dp"
android:visibility="gone"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_toLeftOf="#+id/btnOnSale"
android:background="#drawable/round_button_progress_bar"
>
<com.spoof.app.customcontrol.CustomTextViewRegular
android:id="#+id/txtUpdateTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="15dp"
android:maxLines="1"
android:textAllCaps="false"
android:textColor="#color/colorWhite"
android:textSize="12sp"
android:textStyle="normal"
/>
<app.minimize.com.seek_bar_compat.SeekBarCompat
android:id="#+id/range_slider5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_toLeftOf="#+id/txtTotalTime"
android:layout_toRightOf="#+id/txtUpdateTime"
android:maxHeight="300sp"
app:progressBackgroundColor="#color/colorWhite"
app:progressColor="#color/colorWhite"
app:thumbColor="#color/colorWhite"
/>
<com.spoof.app.customcontrol.CustomTextViewRegular
android:id="#+id/txtTotalTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="15dp"
android:maxLines="1"
android:textAllCaps="false"
android:textColor="#color/colorWhite"
android:textSize="12sp"
android:textStyle="normal"
/>
</RelativeLayout>
<com.spoof.app.customcontrol.CustomButtonRegular
android:id="#+id/btnOnSale"
style="#style/MyCustomButton"
android:layout_width="100dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_marginRight="15dp"
android:background="#drawable/round_button_progress_bar"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:text="#string/on_sale"
android:textAllCaps="false"
android:textColor="#color/colorWhite"
android:textSize="13sp"
android:textStyle="normal"
android:visibility="gone"
/>
<LinearLayout
android:id="#+id/linearGift"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="15dp"
android:background="#drawable/round_button_progress_bar"
android:gravity="center"
android:visibility="gone"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="8dp"
android:src="#drawable/ic_gift"
/>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/imgSpoofImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:scaleType="fitXY"
/>
<RelativeLayout
android:id="#+id/relativeImgCorner"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</RelativeLayout>
<com.spoof.app.customcontrol.CustomButtonRegular
android:id="#+id/gobbleImgTxt"
style="#style/MyCustomButton"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="25dp"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:alpha="0.5"
android:background="#drawable/round_button_progress_bar"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:textAllCaps="false"
android:textColor="#color/colorWhite"
android:textSize="12sp"
android:textStyle="normal"
android:visibility="gone"
/>
</RelativeLayout>
<com.spoof.app.customcontrol.CustomButtonRegular
android:id="#+id/btnOnSaleImage"
style="#style/MyCustomButton"
android:layout_width="80dp"
android:layout_height="30dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_margin="15dp"
android:background="#drawable/round_button_progress_bar"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:text="#string/on_sale"
android:textAllCaps="false"
android:textColor="#color/colorWhite"
android:textSize="12sp"
android:textStyle="normal"
android:visibility="gone"
/>
<LinearLayout
android:id="#+id/linearGiftImage"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_margin="15dp"
android:background="#drawable/round_button_progress_bar"
android:gravity="center"
android:visibility="gone"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="8dp"
android:src="#drawable/ic_gift"
/>
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<LinearLayout
android:id="#+id/linearTop"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:orientation="vertical"
>
<com.spoof.app.customcontrol.CustomTextViewLight
android:id="#+id/txtComment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="80dp"
android:layout_marginTop="5dp"
android:gravity="left|center_vertical"
android:textAllCaps="false"
android:textColor="#color/colorCrownBlack"
android:textSize="28sp"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="80dp"
android:orientation="horizontal"
>
<ImageView
android:id="#+id/imgCrown"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:scaleType="fitXY"
/>
<com.spoof.app.customcontrol.CustomTextViewLight
android:id="#+id/txtTotalSpoof"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:textAllCaps="false"
android:textColor="#color/colorCrownBlack"
android:textSize="13sp"
/>
</LinearLayout>
<RelativeLayout
android:id="#+id/relativeMain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<RelativeLayout
android:id="#+id/relativeImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<ImageView
android:id="#+id/imgProfileBG"
android:layout_width="55dp"
android:layout_height="73dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:scaleType="fitXY"
/>
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/imgProfile"
android:layout_width="55dp"
android:layout_height="55dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:layout_marginTop="18dp"
app:civ_border_width="4dp"
/>
</RelativeLayout>
<com.spoof.app.customcontrol.CustomTextViewMedium
android:id="#+id/txtUserName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp"
android:layout_toRightOf="#+id/relativeImage"
android:maxLines="1"
android:textAllCaps="false"
android:textColor="#color/colorDarkGray"
android:textSize="18sp"
/>
<com.spoof.app.customcontrol.CustomTextViewRegular
android:id="#+id/txtTrendTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/txtUserName"
android:layout_marginLeft="10dp"
android:layout_toRightOf="#+id/relativeImage"
android:maxLines="1"
android:text=""
android:textAllCaps="false"
android:textColor="#color/colorLoginText"
android:textSize="12sp"
/>
<com.spoof.app.customcontrol.CustomButtonRegular
android:id="#+id/btnFollow"
style="#style/MyCustomButton"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="#drawable/round_button_light_gray"
android:text="#string/following"
android:textAllCaps="false"
android:textColor="#color/colorCrownBlack"
android:textSize="10sp"
android:textStyle="normal"
android:visibility="gone"
/>
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginTop="5dp"
android:scaleType="fitXY"
android:src="#drawable/ic_separador"
/>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/rclTrendDetail"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="fill_vertical"
android:scrollbars="vertical"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
>
</android.support.v7.widget.RecyclerView>
</android.support.design.widget.CoordinatorLayout>
<LinearLayout
android:id="#+id/linearShare"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_margin="5dp"
android:gravity="center"
android:layout_alignParentRight="true"
android:layout_below="#+id/relativeTop"
>
<ImageView
android:id="#+id/imgShare"
android:layout_width="30dp"
android:layout_height="32dp"
android:layout_gravity="center"
android:src="#drawable/ico_share"
/>
</LinearLayout>
<RelativeLayout
android:id="#+id/relativeHome"
android:layout_width="61dp"
android:layout_height="61dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="30dp"
android:visibility="visible"
>
<info.hoang8f.widget.FButton
android:id="#+id/imgHome"
fbutton:buttonColor="#color/colorDarkGray"
fbutton:cornerRadius="5dp"
fbutton:shadowColor="#color/colorTransparent"
fbutton:shadowEnabled="false"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_centerInParent="true"
android:visibility="gone"
app:shadowHeight="0dp"
/>
<ImageView
android:id="#+id/imgIconHome"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_centerInParent="true"
/>
<com.spoof.app.customcontrol.CustomTextViewMedium
android:id="#+id/txtTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:textColor="#color/colorDarkGray"
android:textSize="16sp"
android:visibility="gone"
/>
</RelativeLayout>
</RelativeLayout>
I don't think that's possible, but if you always want to collapse the appbar, regardless of the position that you choose, you could simply call this after every request for the scroll:
appBarLayout.setExpanded(true/false)
This will cause the app bar to collapse.
Further reading:
AppBarLayout.setExpanded(boolean)
Out of scope:
You should split your XML files into more layouts and use <include> tag, this will greatly improve readability of those files.
I've got a problem with adding logo to my app.
Now it's like:
HERE IS A LOGO - CLICK (haven't got 10 reputation)
I want to have a imageview with logo (id: logo) above the box with login.
How to make it?
Layout.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:facebook="http://schemas.android.com/tools"
xmlns:fb="http://schemas.android.com/tools"
android:id="#+id/mainView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="#drawable/log"
android:gravity="center"
android:orientation="vertical">
<ScrollView
android:background="#drawable/log"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true">
<RelativeLayout
android:background="#drawable/login"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:layout_width="350dp"
android:layout_marginLeft="17dp"
android:layout_height="300dp"
android:layout_marginTop="120dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="300dp"
app:srcCompat="#drawable/napis"
android:id="#+id/logosek" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_below="#+id/social_signin_layout"
android:layout_marginTop="10dp"
android:background="#color/md_white_1000"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:id="#+id/tv_or"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginTop="4dp"
android:text="#string/screen_login_or_label"
android:textColor="#color/md_black_1000"
android:textSize="24sp" />
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:textColorHint="#color/material_color_primary"
app:hintAnimationEnabled="true"
app:hintTextAppearance="#style/TextAppearance.AppCompat.Small">
<EditText
android:id="#+id/et_usernamelogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/screen_register_hint_email"
android:inputType="text"
android:singleLine="true"
android:textSize="18sp" />
</android.support.design.widget.TextInputLayout>
<!--<EditText-->
<!--android:id="#+id/"-->
<!--style="#style/edittextstyle"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="#dimen/editlayimg_edittextheight"-->
<!--android:layout_marginTop="#dimen/five"-->
<!--android:gravity="bottom"-->
<!--android:hint="#string/login_storeid"-->
<!--android:singleLine="true"-->
<!--android:textColorHint="#color/fontcolorlight"-->
<!--android:textSize="18sp" />-->
<!--<View-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="#dimen/one"-->
<!--android:layout_marginLeft="#dimen/five"-->
<!--android:layout_marginRight="#dimen/five"-->
<!--android:background="#color/fontcolorlight" />-->
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:textColorHint="#color/material_color_primary"
app:hintAnimationEnabled="true"
app:hintTextAppearance="#style/TextAppearance.AppCompat.Small">
<EditText
android:id="#+id/et_passwordlogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
android:inputType="text"
android:singleLine="true"
android:textSize="18sp" />
</android.support.design.widget.TextInputLayout>
<Button
android:id="#+id/btn_login"
style="#style/Widget.AppCompat.Button.Borderless.Colored"
android:layout_width="match_parent"
android:layout_height="#dimen/btnheight"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="4dp"
android:background="#color/material_color_accent"
android:text="#string/screen_login_button_login"
android:textColor="#color/md_white_1000"
android:textSize="#dimen/btnlogin_textsize" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="4dp"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/txt_signup"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:layout_marginRight="16dp"
android:layout_marginTop="12dp"
android:layout_weight="1"
android:gravity="left"
android:paddingLeft="8dp"
android:text="#string/screen_login_button_sign_up"
android:textColor="#color/md_black_1000"
android:textSize="16sp"
android:layout_width="wrap_content" />
<TextView
android:id="#+id/tv_forgotpwd"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:layout_marginTop="12dp"
android:layout_weight="1"
android:gravity="right"
android:paddingRight="8dp"
android:text="Forgot Password?"
android:textColor="#color/md_black_1000"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/lay_above"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/md_brown_100"
android:orientation="vertical"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
</LinearLayout>
<LinearLayout
android:id="#+id/social_signin_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="100dp"
android:layout_below="#+id/lay_above"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:text="Choose account to login"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:textColor="#color/md_yellow_50"
android:textAlignment="center"
android:textSize="17sp" />
<com.google.android.gms.common.SignInButton
android:id="#+id/btn_sign_in"
android:layout_width="300dp"
android:layout_marginBottom="0dp"
android:layout_marginLeft="16dp"
android:layout_gravity="center_vertical|center_horizontal"
android:textSize="18sp"
android:textStyle="bold"
android:layout_marginRight="16dp"
android:padding="0dp"
android:theme="#style/Widget.AppCompat.Button"
app:theme="#style/Widget.AppCompat.Button"
android:layout_height="35dp"
android:layout_marginTop="10dp" />
<TextView
android:layout_width="match_parent"
android:layout_marginTop="5dp"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:text="or"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:textColor="#color/AntiqueWhite"
android:textAlignment="center"
android:textSize="18sp"
android:id="#+id/textView10" />
<com.facebook.login.widget.LoginButton
android:id="#+id/authButton"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="10dp"
android:textSize="18sp"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_width="300dp"
android:layout_height="50dp" />
<TextView
android:layout_width="match_parent"
android:layout_marginTop="15dp"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:text="#string/please_login_in"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:textColor="#color/md_yellow_50"
android:textAlignment="center"
android:textSize="15sp"
android:id="#+id/textView12" />
</LinearLayout>
<TextView
android:text="Welcome, Saiyan!"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="36dp"
android:id="#+id/textView14"
android:textSize="36sp"
android:layout_below="#+id/lay_above"
android:layout_centerHorizontal="true"
android:textColor="#color/Yellow" />
</RelativeLayout>
</ScrollView>
</LinearLayout>
just put the imageview before the relative layout
instead of:
<RelativeLayout
android:background="#drawable/login"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:layout_width="350dp"
android:layout_marginLeft="17dp"
android:layout_height="300dp"
android:layout_marginTop="120dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="300dp"
app:srcCompat="#drawable/napis"
android:id="#+id/logosek" />
do:
<ImageView
android:layout_width="match_parent"
android:layout_height="300dp"
app:srcCompat="#drawable/napis"
android:id="#+id/logosek" />
<RelativeLayout
android:background="#drawable/login"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:layout_width="350dp"
android:layout_marginLeft="17dp"
android:layout_height="300dp"
android:layout_marginTop="120dp">
this will put imageview in the scrollview and below it the rest of the relativelayout , all because of the linearlayout orientation which directed vertical , so every child will come below the former.
EDIT :
you also need to put the scrollview first and then put the linearlayout , this should be it :
<?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:facebook="http://schemas.android.com/tools"
xmlns:fb="http://schemas.android.com/tools"
android:background="#drawable/log"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true">
<LinearLayout
android:id="#+id/mainView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="#drawable/log"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="300dp"
app:srcCompat="#drawable/napis"
android:id="#+id/logosek" />
<RelativeLayout
android:background="#drawable/login"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:layout_width="350dp"
android:layout_marginLeft="17dp"
android:layout_height="300dp"
android:layout_marginTop="120dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_below="#+id/social_signin_layout"
android:layout_marginTop="10dp"
android:background="#color/md_white_1000"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:id="#+id/tv_or"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginTop="4dp"
android:text="#string/screen_login_or_label"
android:textColor="#color/md_black_1000"
android:textSize="24sp" />
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:textColorHint="#color/material_color_primary"
app:hintAnimationEnabled="true"
app:hintTextAppearance="#style/TextAppearance.AppCompat.Small">
<EditText
android:id="#+id/et_usernamelogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/screen_register_hint_email"
android:inputType="text"
android:singleLine="true"
android:textSize="18sp" />
</android.support.design.widget.TextInputLayout>
<!--<EditText-->
<!--android:id="#+id/"-->
<!--style="#style/edittextstyle"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="#dimen/editlayimg_edittextheight"-->
<!--android:layout_marginTop="#dimen/five"-->
<!--android:gravity="bottom"-->
<!--android:hint="#string/login_storeid"-->
<!--android:singleLine="true"-->
<!--android:textColorHint="#color/fontcolorlight"-->
<!--android:textSize="18sp" />-->
<!--<View-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="#dimen/one"-->
<!--android:layout_marginLeft="#dimen/five"-->
<!--android:layout_marginRight="#dimen/five"-->
<!--android:background="#color/fontcolorlight" />-->
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:textColorHint="#color/material_color_primary"
app:hintAnimationEnabled="true"
app:hintTextAppearance="#style/TextAppearance.AppCompat.Small">
<EditText
android:id="#+id/et_passwordlogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
android:inputType="text"
android:singleLine="true"
android:textSize="18sp" />
</android.support.design.widget.TextInputLayout>
<Button
android:id="#+id/btn_login"
style="#style/Widget.AppCompat.Button.Borderless.Colored"
android:layout_width="match_parent"
android:layout_height="#dimen/btnheight"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="4dp"
android:background="#color/material_color_accent"
android:text="#string/screen_login_button_login"
android:textColor="#color/md_white_1000"
android:textSize="#dimen/btnlogin_textsize" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="4dp"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/txt_signup"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:layout_marginRight="16dp"
android:layout_marginTop="12dp"
android:layout_weight="1"
android:gravity="left"
android:paddingLeft="8dp"
android:text="#string/screen_login_button_sign_up"
android:textColor="#color/md_black_1000"
android:textSize="16sp"
android:layout_width="wrap_content" />
<TextView
android:id="#+id/tv_forgotpwd"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:layout_marginTop="12dp"
android:layout_weight="1"
android:gravity="right"
android:paddingRight="8dp"
android:text="Forgot Password?"
android:textColor="#color/md_black_1000"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/lay_above"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/md_brown_100"
android:orientation="vertical"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
</LinearLayout>
<LinearLayout
android:id="#+id/social_signin_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="100dp"
android:layout_below="#+id/lay_above"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:text="Choose account to login"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:textColor="#color/md_yellow_50"
android:textAlignment="center"
android:textSize="17sp" />
<com.google.android.gms.common.SignInButton
android:id="#+id/btn_sign_in"
android:layout_width="300dp"
android:layout_marginBottom="0dp"
android:layout_marginLeft="16dp"
android:layout_gravity="center_vertical|center_horizontal"
android:textSize="18sp"
android:textStyle="bold"
android:layout_marginRight="16dp"
android:padding="0dp"
android:theme="#style/Widget.AppCompat.Button"
app:theme="#style/Widget.AppCompat.Button"
android:layout_height="35dp"
android:layout_marginTop="10dp" />
<TextView
android:layout_width="match_parent"
android:layout_marginTop="5dp"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:text="or"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:textColor="#color/AntiqueWhite"
android:textAlignment="center"
android:textSize="18sp"
android:id="#+id/textView10" />
<com.facebook.login.widget.LoginButton
android:id="#+id/authButton"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="10dp"
android:textSize="18sp"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_width="300dp"
android:layout_height="50dp" />
<TextView
android:layout_width="match_parent"
android:layout_marginTop="15dp"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:text="#string/please_login_in"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:textColor="#color/md_yellow_50"
android:textAlignment="center"
android:textSize="15sp"
android:id="#+id/textView12" />
</LinearLayout>
<TextView
android:text="Welcome, Saiyan!"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="36dp"
android:id="#+id/textView14"
android:textSize="36sp"
android:layout_below="#+id/lay_above"
android:layout_centerHorizontal="true"
android:textColor="#color/Yellow" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
I developed an android application in which the scroll-view is not scrolling.. I am posting the code here please check and if found any error please help.. Here I used ScrollView as root and then LinearLayout... but this is not scrolling up.. I Updated the xml still not working
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center|top"
android:orientation="vertical"
android:background="#color/colorPrimary"
android:weightSum="1">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:id="#+id/arrowImageView"
android:src="#drawable/logo_grey"
/>
<TextView
android:id="#+id/NameTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="20dp"
android:textStyle="bold"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<TextView
android:id="#+id/dTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<TextView
android:id="#+id/positionTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<TextView
android:id="#+id/IdTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_id"
android:textSize="15dp"
android:layout_marginBottom="#dimen/activity_vertical_margin"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<!--items-->
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#android:color/white"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/image1"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:src="#drawable/takeoff_color"
android:layout_alignParentStart="true"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_b"
android:textSize="15dp"
android:layout_toEndOf="#id/image1"
android:textStyle="bold"
android:textColor="#color/colorPrimary" />
<TextView
android:id="#+id/sTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#color/colorPrimary" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/image2"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/document"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_date"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#id/image2"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/DateTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#android:color/white" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#android:color/white"
android:paddingTop="10dp"
android:paddingBottom="10dp"
>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/image3"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/document_color"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_end_of"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#id/image3"
android:textColor="#color/colorPrimary" />
<TextView
android:id="#+id/endOfTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:gravity="start"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#color/colorPrimary" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/imageView"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/ic_action_money"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_c"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#+id/imageView"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/currentSalaryTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#android:color/white" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#android:color/white"
android:paddingTop="10dp"
android:paddingBottom="10dp"
>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/imageView2"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/bag_color"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_h_total"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#+id/imageView2"
android:textColor="#color/colorPrimary" />
<TextView
android:id="#+id/salaryTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#color/colorPrimary" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp"
>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/imageView3"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/purchase_order"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_g"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#+id/imageView3"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/gTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#android:color/white" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
EDITED AS BELOW, but still not working well, the scrollbar stop at half of label name:"label_h_total"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center|top"
android:orientation="vertical"
android:background="#color/colorPrimary"
>
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:id="#+id/arrowImageView"
android:src="#drawable/logo_grey"
/>
<TextView
android:id="#+id/NameTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="20dp"
android:textStyle="bold"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<TextView
android:id="#+id/dTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<TextView
android:id="#+id/positionTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<TextView
android:id="#+id/IdTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_id"
android:textSize="15dp"
android:layout_marginBottom="#dimen/activity_vertical_margin"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<!--items-->
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#android:color/white"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/image1"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:src="#drawable/takeoff_color"
android:layout_alignParentStart="true"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_b"
android:textSize="15dp"
android:layout_toEndOf="#id/image1"
android:textStyle="bold"
android:textColor="#color/colorPrimary" />
<TextView
android:id="#+id/sTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#color/colorPrimary" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/image2"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/document"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_date"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#id/image2"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/DateTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#android:color/white" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#android:color/white"
android:paddingTop="10dp"
android:paddingBottom="10dp"
>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/image3"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/document_color"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_end_of"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#id/image3"
android:textColor="#color/colorPrimary" />
<TextView
android:id="#+id/endOfTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:gravity="start"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#color/colorPrimary" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/imageView"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/ic_action_money"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_c"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#+id/imageView"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/currentSalaryTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#android:color/white" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#android:color/white"
android:paddingTop="10dp"
android:paddingBottom="10dp"
>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/imageView2"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/bag_color"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_h_total"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#+id/imageView2"
android:textColor="#color/colorPrimary" />
<TextView
android:id="#+id/salaryTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#color/colorPrimary" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp"
>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/imageView3"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/purchase_order"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_g"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#+id/imageView3"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/gTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#android:color/white" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
The Warning
A scrolling widget such as a ScrollView should not contain any nested scrolling widgets since this has various usability issues
This should be works. There was a problem with the LinearLayout, the height was wrap_content. The first child of scrollview needs to have only match_parent for both width and height and that's it.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#color/colorPrimary">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:id="#+id/arrowImageView"
android:src="#drawable/logo_grey"
/>
<TextView
android:id="#+id/NameTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="20dp"
android:textStyle="bold"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<TextView
android:id="#+id/dTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<TextView
android:id="#+id/positionTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<TextView
android:id="#+id/IdTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_id"
android:textSize="15dp"
android:layout_marginBottom="#dimen/activity_vertical_margin"
android:textColor="#android:color/white"
android:gravity="center_horizontal" />
<!--items-->
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#android:color/white"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/image1"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:src="#drawable/takeoff_color"
android:layout_alignParentStart="true"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_b"
android:textSize="15dp"
android:layout_toEndOf="#id/image1"
android:textStyle="bold"
android:textColor="#color/colorPrimary" />
<TextView
android:id="#+id/sTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#color/colorPrimary" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/image2"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/document"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_date"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#id/image2"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/DateTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#android:color/white" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#android:color/white"
android:paddingTop="10dp"
android:paddingBottom="10dp"
>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/image3"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/document_color"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_end_of"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#id/image3"
android:textColor="#color/colorPrimary" />
<TextView
android:id="#+id/endOfTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:gravity="start"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#color/colorPrimary" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/imageView"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/ic_action_money"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_c"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#+id/imageView"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/currentSalaryTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#android:color/white" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#android:color/white"
android:paddingTop="10dp"
android:paddingBottom="10dp"
>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/imageView2"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/bag_color"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_h_total"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#+id/imageView2"
android:textColor="#color/colorPrimary" />
<TextView
android:id="#+id/salaryTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#color/colorPrimary" />
</RelativeLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingTop="10dp"
android:paddingBottom="10dp"
>
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:id="#+id/imageView3"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_alignParentStart="true"
android:src="#drawable/purchase_order"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/label_g"
android:textSize="15dp"
android:textStyle="bold"
android:layout_toEndOf="#+id/imageView3"
android:textColor="#android:color/white" />
<TextView
android:id="#+id/gTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="-"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:textColor="#android:color/white" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center|top"
android:orientation="vertical"
android:background="#color/colorPrimary"
android:weightSum="1">
xmlns:tools="http://schemas.android.com/tools" put this in scrollview and edit child of scrollview.
I have a relative layout which contains two linear layouts. I want these two linear layouts to be placed in either halves of the relative layout containing them i.e. one to be positioned at top half and other at bottom half. Can anyone here help me with this. Here is the xml:
<RelativeLayout
android:id="#+id/updatedetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:orientation="vertical"
android:background="#drawable/oneeventbkg" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="#+id/Top_half_layout">
<ImageView
android:id="#+id/update_sn_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="2dp" />
<TextView
android:id="#+id/update_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_margin="5dp"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageView
android:id="#+id/update_message_pic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#id/update_sn_icon"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp" />
<TextView
android:id="#+id/update_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#id/update_message_pic"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:maxHeight="400dp"
android:scrollbars="vertical"
android:textColor="#android:color/white"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="#+id/bottom_half_layout">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:id="#+id/toggle_after"
android:visibility="invisible">
<TextView
android:id="#+id/toggle_like_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="10dp"
android:text="1000"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/toggle_like_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_like_button_selctor" />
<TextView
android:id="#+id/toggle_comment_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="7dp"
android:text="100"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/toggle_comment_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_comment_button_selector" />
</LinearLayout>
<ListView
android:id="#+id/likes_list"
android:layout_width="wrap_content"
android:layout_height="200dp"
android:layout_below="#id/toggle_after"
android:padding="20dp"
/>
<ListView
android:id="#+id/comments_list"
android:layout_width="wrap_content"
android:layout_height="200dp"
android:layout_below="#id/toggle_after"
android:padding="20dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_below="#id/comments_list"
android:layout_marginBottom="10dp"
android:id="#+id/toggle_content"
android:layout_alignParentBottom="true">
<TextView
android:id="#+id/like_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="10dp"
android:text="1000"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/like_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_like_button_selctor" />
<TextView
android:id="#+id/comment_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="7dp"
android:text="100"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/comment_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_comment_button_selector" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
Try this..
<LinearLayout
android:id="#+id/updatedetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:orientation="vertical"
android:background="#drawable/oneeventbkg" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="#+id/Top_half_layout">
// Your Codes
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="#+id/bottom_half_layout">
// Your Codes
</LinearLayout>
</LinearLayout>
EDIT
<LinearLayout
android:id="#+id/updatedetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:orientation="vertical"
android:background="#drawable/oneeventbkg" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="#+id/Top_half_layout">
// Your Codes
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="#+id/bottom_half_layout">
// Your Codes
</RelativeLayout>
</LinearLayout>
// Try this way,hope this will help you to solve your problem...
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/updatedetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:background="#drawable/oneeventbkg" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="#+id/Top_half_layout"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/update_sn_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginLeft="10dp"
android:layout_marginTop="2dp" />
<TextView
android:id="#+id/update_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:textColor="#android:color/white"
android:layout_gravity="right"
android:textSize="14sp" />
</LinearLayout>
<ImageView
android:id="#+id/update_message_pic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp" />
<TextView
android:id="#+id/update_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:maxHeight="400dp"
android:scrollbars="vertical"
android:textColor="#android:color/white"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="#+id/bottom_half_layout"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:id="#+id/toggle_after"
android:visibility="invisible">
<TextView
android:id="#+id/toggle_like_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="10dp"
android:text="1000"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/toggle_like_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_like_button_selctor" />
<TextView
android:id="#+id/toggle_comment_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="7dp"
android:text="100"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/toggle_comment_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_comment_button_selector" />
</LinearLayout>
<ListView
android:id="#+id/likes_list"
android:layout_width="wrap_content"
android:layout_height="200dp"
android:padding="20dp" />
<ListView
android:id="#+id/comments_list"
android:layout_width="wrap_content"
android:layout_height="200dp"
android:padding="20dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:id="#+id/toggle_content">
<TextView
android:id="#+id/like_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="10dp"
android:text="1000"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/like_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_like_button_selctor" />
<TextView
android:id="#+id/comment_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="7dp"
android:text="100"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/comment_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_comment_button_selector" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>