I went through different solutions from stackoverflow and web, but didn't work. the scrollbar of listView is very tiny, I want it to be large enough. I used android:scrollbarSize="55dip" but it didn't work, android ignores it.
activity_main.xml :
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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:fitsSystemWindows="true"
tools:context=".MainActivity">
<RadioGroup
android:id="#+id/radioGroup"
android:layout_width="368dp"
android:layout_height="47dp"
android:layout_gravity="end"
android:layout_marginStart="8dp"
android:layout_marginTop="32dp"
android:orientation="horizontal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/editText">
<RadioButton
android:id="#+id/azadRadio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_weight="1"
android:gravity="right"
android:layoutDirection="rtl"
android:text="آزاد"
android:textSize="30sp" />
<RadioButton
android:id="#+id/qafiaRadio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_weight="1"
android:gravity="right"
android:layoutDirection="rtl"
android:text="قافیہ"
android:textSize="30sp" />
<RadioButton
android:id="#+id/sabiqaRadio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_weight="1"
android:gravity="right"
android:layoutDirection="rtl"
android:text="سابقہ"
android:textSize="30sp" />
</RadioGroup>
<EditText
android:id="#+id/editText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="36dp"
android:layout_marginTop="36dp"
android:ems="10"
android:inputType="text"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="#+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="36dp"
android:layout_marginEnd="8dp"
android:onClick="Finder"
android:text="Finder"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.555"
app:layout_constraintStart_toEndOf="#+id/editText"
app:layout_constraintTop_toTopOf="parent" />
<ListView
android:id="#+id/listView"
android:layout_width="359dp"
android:layout_height="0dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="44dp"
android:scrollbars="vertical"
android:verticalScrollbarPosition="left"
android:scrollbarSize="55dip"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/radioGroup" />
</android.support.constraint.ConstraintLayout>
custom.xml :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/textView"
android:paddingRight="40dp"
android:scrollbarSize="55dip"
android:textSize="20px" android:paddingTop="10dip" android:paddingBottom="10dip"/>
</LinearLayout>
Use this line too with the scrollsize you used:
android:scrollbarThumbVertical="#color/colorPrimaryDark"
Related
I have a "activity_main_layout.xml" and this is the only activity in my app. I am using a custom toolbar which I included inside my "activity_main_layout.xml". I am unable to add navigation view as when I change my ConstraintLayout to DrawerLayout and also include my toolbar, I do not get the Burger Icon which is used to open navigation drawer.
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout 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="#drawable/back"
android:id="#+id/drawerLayout"
tools:context=".Activities.MainLayout">
<com.google.android.material.navigation.NavigationView
android:layout_width="wrap_content"
android:layout_height="match_parent"
app:headerLayout="#layout/navigation_header"
app:menu="#menu/side_menu"
android:id="#+id/navView"
android:layout_gravity="start"/>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/back">
<include android:id="#+id/toolbar"
layout="#layout/toolbar"/>
<com.google.android.material.tabs.TabLayout
android:id="#+id/tab"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/dark_trans"
app:tabTextColor="#color/grey"
app:tabSelectedTextColor="#color/yellow"
app:tabIndicatorColor="#color/yellow"
app:layout_constraintTop_toBottomOf="#id/toolbar"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
/>
<androidx.viewpager2.widget.ViewPager2
android:id="#+id/viewPager"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="#id/tab"
app:layout_constraintBottom_toTopOf="#id/MusicPlaySection"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
/>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/MusicPlaySection"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:background="#0000"
android:paddingTop="#dimen/_6sdp"
app:layout_constraintRight_toRightOf="parent">
<LinearLayout
android:id="#+id/L1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="#id/seekBar"
app:layout_constraintLeft_toLeftOf="#id/startingMusic"
>
<TextView
android:id="#+id/tag1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/allerta"
android:text="Playing Now:"
android:textColor="#color/white"
android:textSize="#dimen/_15ssp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="#id/seekBar"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="#id/currentSongPlaying"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/currentSongPlaying"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:fontFamily="#font/b612_italic"
android:paddingLeft="#dimen/_2sdp"
android:textColor="#color/white"
android:textSize="#dimen/_15ssp"
android:maxLength="17"
android:textAllCaps="true"
app:layout_constraintBottom_toTopOf="#id/seekBar"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</LinearLayout>
<SeekBar
android:id="#+id/seekBar"
android:layout_width="#dimen/_210sdp"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_10sdp"
app:layout_constraintTop_toBottomOf="#id/L1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:progressTint="#color/yellow"
android:thumbTint="#color/yellow"
/>
<TextView
android:id="#+id/startingMusic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0:00"
android:textSize="#dimen/_12ssp"
android:textColor="#color/white"
app:layout_constraintRight_toLeftOf="#id/seekBar"
app:layout_constraintTop_toTopOf="#id/seekBar"
app:layout_constraintBottom_toBottomOf="#id/seekBar"
/>
<TextView
android:id="#+id/endingMusic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0:00"
android:textSize="#dimen/_12ssp"
android:textColor="#color/white"
app:layout_constraintLeft_toRightOf="#id/seekBar"
app:layout_constraintTop_toTopOf="#id/seekBar"
app:layout_constraintBottom_toBottomOf="#id/seekBar"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintTop_toBottomOf="#id/startingMusic"
>
<Space
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
<ImageView
android:id="#+id/previousBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/previous_icon_foreground"
/>
<ImageView
android:id="#+id/playBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/play_icon_foreground"
/>
<ImageView
android:id="#+id/pauseBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
android:src="#drawable/pause_icon_foreground"
/>
<ImageView
android:id="#+id/nextBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/next_icon_foreground"
/>
<Space
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.drawerlayout.widget.DrawerLayout>
I want to create a view like this.
The problem is, that when the TextView size is bigger, it looks like this.
So it overlaps "View all (35)" TextView. How to prevent the overlapping? The ImageView should be right of TextView, but it has not to overlap "View all (35)". I think you understand. Thank you.
Here's the xml file.
<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="wrap_content">
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:fontFamily="#font/montserrat_semi_bold"
android:maxLines="1"
android:layout_alignParentStart="true"
android:textColor="#color/colorTextDark"
android:textSize="#dimen/text_extra_large"
tools:text="Birthday" />
<ImageView
android:id="#+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="8dp"
android:layout_marginEnd="16dp"
android:layout_toEndOf="#+id/textView"
android:src="#drawable/wishlist_public" />
<TextView
android:id="#+id/textViewAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:fontFamily="#font/montserrat_semi_bold"
android:text="View all (35)"
android:layout_alignParentEnd="true"
android:textColor="#color/colorTextPrimary"
android:textSize="#dimen/text_small" />
</RelativeLayout>
Try to put your imageView to textView's drawableEnd property, after put it in nested linear layout and give to it a weight.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableEnd="#drawable/imageView"
android:layout_marginStart="16dp"
android:maxLines="1"
android:gravity="start|center"
android:textSize="#dimen/text_extra_large"
android:ellipsize="end"
android:text="Your text here" />
<Space
android:layout_width="match_parent"
android:layout_height="match_parent">
</Space>
</LinearLayout>
<TextView
android:id="#+id/textViewAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:gravity="end"
android:layout_gravity="center_vertical"
android:text="View All"
android:textSize="#dimen/text_small" />
</LinearLayout>
Try this(Please add some of your dimens property that i remove because i didn't had them) :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:paddingTop="10dp"
android:weightSum="3">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="3">
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_marginStart="16dp"
android:maxLines="1"
android:textSize="20dp"
tools:text="Birthdayyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy" />
<ImageView
android:id="#+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="8dp"
android:layout_marginEnd="16dp"
android:layout_toRightOf="#id/textView"
android:src="#drawable/wishlist_public"
/>
</LinearLayout>
<TextView
android:id="#+id/textViewAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_gravity="right"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_weight="2"
android:text="View all (35)"
android:textSize="20dp" />
</LinearLayout>
I think you can use Linearlayout to achieve something like that I use to write this code and I think it can help you achieve this layout design
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="10dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="#+id/textView2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Birthdayyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"
android:layout_weight="1"
android:textSize="20sp" />
<ImageView
android:id="#+id/imageView"
android:layout_width="24dp"
android:layout_height="24dp"
android:src="#111"
android:layout_marginStart="10dp" />
</LinearLayout>
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="View All(35)"
android:textSize="20sp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_weight="1"/>
</LinearLayout>
After that, you will get something like that
Click here to view image
Try to use ContraintLayout and use Barrier constraint or Guidline constraint to achiever you desired layout
I have fixed using guideline contraint
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:paddingTop="16dp">
<TextView
android:id="#+id/textView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="24sp"
android:maxLines="1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="#+id/guideline"
app:layout_constraintHorizontal_bias="0.095"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.005"
tools:text="Birthday" />
<ImageView
android:id="#+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ic_adb_black_24dp"
app:layout_constraintBottom_toBottomOf="#+id/textViewAll"
app:layout_constraintEnd_toStartOf="#+id/textViewAll"
app:layout_constraintHorizontal_bias="0.13"
app:layout_constraintStart_toStartOf="#+id/guideline"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0" />
<TextView
android:id="#+id/textViewAll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="View all (35)"
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="333dp" />
<androidx.constraintlayout.widget.Guideline
android:id="#+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.62" />
</androidx.constraintlayout.widget.ConstraintLayout>
I have a RecyclerView with a ViewPager inside it, which in turn have another recyclerView. The recyclerView inside a ViewPager don't load whole items, but only one, and don't scroll to show the rest of the items
I have tried to set the layout_height of the two recycler view with wrap_content, and also nested it inside a nestedSCrollView, without success.
// First outside recyclerview
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
// cell item with viewPager
<com.google.android.material.tabs.TabLayout
android:id="#+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="50dp" />
<androidx.viewpager.widget.ViewPager
android:id="#+id/viewPager"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
// recyclerView inside viewPager
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
I expect that the outside recyclerView fill the whole height of the items, instead the recycler view inside seams that don't load the whole items but the only one that is visible in the screen, without scroll.
EDIT
fragment__events_detail (layout)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:layout_marginBottom="#dimen/toolbar__height"
tools:layout_marginTop="#dimen/actionbar__height">
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
The first cell of the recycler view
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/mainContainer"
android:layout_width="match_parent"
android:layout_height="300dp"
android:orientation="vertical">
<!-- img video club -->
<ImageView
android:id="#+id/imgVideoClub"
android:layout_width="0dp"
android:layout_height="300dp"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:srcCompat="#tools:sample/avatars[12]" />
<!-- play icon -->
<ImageView
android:id="#+id/playIcon"
android:layout_width="60dp"
android:layout_height="60dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/play_icon" />
<LinearLayout
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_marginTop="8dp"
android:layout_marginRight="8dp"
android:background="#drawable/btn_rounded_orange_outline_red_bg"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="#+id/imageView8"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center"
android:layout_marginTop="8dp"
app:srcCompat="#drawable/prohibition_icon" />
<TextView
android:text="Segnala abuso"
android:textColor="#fff"
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
The second cell with a tablayout and a viewpager
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.google.android.material.tabs.TabLayout
android:id="#+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="50dp" />
<androidx.viewpager.widget.ViewPager
android:id="#+id/viewPager"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
The fragment inside first tab of the viewPager with a recyclerView inside
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:layout_marginBottom="#dimen/toolbar__height"
tools:layout_marginTop="#dimen/actionbar__height">
<!-- header -->
<TextView
android:text="Eventi"
style="#style/header_txtStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<!-- separator -->
<View
android:background="#color/separator_background"
android:layout_width="wrap_content"
android:layout_height="1dp"/>
<!-- container events search -->
<LinearLayout
android:orientation="horizontal"
android:paddingLeft="#dimen/main__horizzontalPadding"
android:paddingRight="#dimen/main__horizzontalPadding"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- search icon -->
<ImageView
android:src="#drawable/search_icon"
android:layout_width="20dp"
android:layout_height="30dp" />
<EditText
android:id="#+id/events__home_eventsSearchEditTxt"
android:background="#android:color/transparent"
android:layout_marginLeft="16dp"
android:hint="Cerca eventi"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<!-- separator -->
<View
android:background="#color/separator_background"
android:layout_width="wrap_content"
android:layout_height="3dp"/>
<!-- range time events -->
<androidx.constraintlayout.widget.ConstraintLayout
android:paddingLeft="#dimen/main__horizzontalPadding"
android:paddingRight="#dimen/main__horizzontalPadding"
android:layout_width="match_parent"
android:layout_height="50dp">
<TextView
android:id="#+id/events__home_thisWeekTimeTxt"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Questa settimana"
android:textColor="#color/events__home_itemNotSelected"
android:gravity="center"
android:textSize="#dimen/events__home_rangeTimeTxtSize"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/events__home_nextWeekTimeTxt"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Prossima settimana"
android:textColor="#color/events__home_itemNotSelected"
android:textSize="#dimen/events__home_rangeTimeTxtSize"
android:gravity="center"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toLeftOf="#id/events__home_calendarRangeTimeContainer"
app:layout_constraintLeft_toRightOf="#id/events__home_thisWeekTimeTxt"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="#+id/events__home_calendarRangeTimeContainer"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="match_parent">
<TextView
android:id="#+id/events__home_calendarRangeTimeTxt"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textSize="#dimen/events__home_rangeTimeTxtSize"
android:textColor="#color/events__home_itemNotSelected"
android:gravity="center" />
<ImageButton
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:background="#android:color/transparent"
android:padding="5dp"
android:scaleType="centerCrop"
android:src="#drawable/calendar__icon" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
The items of the second recyclerView
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/row__events_home_container"
android:layout_width="match_parent"
android:layout_height="250dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="10dp"
android:background="#drawable/event__background_rounded"
android:padding="20dp">
<ImageView
android:id="#+id/calendarIcon"
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_marginBottom="16dp"
android:scaleType="fitCenter"
app:layout_constraintBottom_toTopOf="#+id/clockIcon"
app:layout_constraintEnd_toEndOf="#+id/clockIcon"
app:layout_constraintStart_toStartOf="#+id/clockIcon"
app:srcCompat="#drawable/calendar__icon" />
<TextView
android:id="#+id/row__events_home_dateEvent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:text="TextView"
android:textColor="#color/events__home_secondaryTextColor"
app:layout_constraintBottom_toBottomOf="#+id/calendarIcon"
app:layout_constraintStart_toEndOf="#+id/calendarIcon"
app:layout_constraintTop_toTopOf="#+id/calendarIcon" />
<TextView
android:id="#+id/row__events_home_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/row__events_home_category"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:textColor="#color/colorPrimary"
app:layout_constraintStart_toStartOf="#+id/row__events_home_title"
app:layout_constraintTop_toBottomOf="#+id/row__events_home_title" />
<ImageView
android:id="#+id/locationIcon"
android:layout_width="0dp"
android:layout_height="30dp"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:srcCompat="#drawable/location__icon" />
<TextView
android:id="#+id/row__events_home_locationEventName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:text="TextView"
android:textColor="#color/events__home_secondaryTextColor"
app:layout_constraintBottom_toBottomOf="#+id/locationIcon"
app:layout_constraintStart_toEndOf="#+id/locationIcon"
app:layout_constraintTop_toTopOf="#+id/locationIcon" />
<ImageView
android:id="#+id/clockIcon"
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_marginBottom="16dp"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
app:layout_constraintBottom_toTopOf="#+id/locationIcon"
app:layout_constraintEnd_toEndOf="#+id/locationIcon"
app:layout_constraintStart_toStartOf="#+id/locationIcon"
app:srcCompat="#drawable/clock__icon" />
<TextView
android:id="#+id/row__events_home_timeEvent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:text="TextView"
android:textColor="#color/events__home_secondaryTextColor"
app:layout_constraintBottom_toBottomOf="#+id/clockIcon"
app:layout_constraintStart_toEndOf="#+id/clockIcon"
app:layout_constraintTop_toTopOf="#+id/clockIcon" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/row__events_home_interestBtn"
android:layout_width="130dp"
android:layout_height="30dp"
android:background="#drawable/btn_rounded_orange_outline"
android:paddingLeft="10dp"
android:paddingRight="20dp"
app:layout_constraintBottom_toBottomOf="#+id/clockIcon"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="#+id/clockIcon">
<ImageView
android:id="#+id/imageView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/interest__events_icon" />
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Mi interessa"
android:textColor="#color/colorPrimary"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="#+id/row__events_home_buyBtn"
android:layout_width="130dp"
android:layout_height="30dp"
android:background="#drawable/btn_rounded_orange_outline"
android:paddingLeft="10dp"
android:paddingRight="20dp"
app:layout_constraintBottom_toBottomOf="#+id/locationIcon"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="#+id/locationIcon">
<TextView
android:id="#+id/textView9"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Prenota"
android:textColor="#color/colorPrimary"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/imageView11"
app:layout_constraintTop_toTopOf="parent"
tools:text="Prenota" />
<ImageView
android:id="#+id/imageView11"
android:layout_width="20dp"
android:layout_height="20dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/ticket__events_buy" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
I am having an issue with designing Android Studio Layout for App. In linear layout, I want to add first two layouts in the first column horizontally and then in the next column, I wish to add that three buttons in horizontally and finally in the last column want to add Listview. Any help would be highly appreciated. As currently, everything falls into one row.
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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"
tools:context=".MainActivity">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<james.view.VideoView
android:id="#+id/remoteVideoView"
android:layout_width="120dp"
android:layout_height="90dp"
/>
<james.view.VideoView
android:id="#+id/localVideoView"
android:layout_width="120dp"
android:layout_height="90dp"
/>
<Button
android:id="#+id/startVideoButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Start Call"
/>
<Button
android:id="#+id/stopVideoButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="End Call"
/>
<Button
android:id="#+id/sendmessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="msg"
/>
<ListView
android:id="#+id/errorList"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</ListView>
</LinearLayout>
</android.support.constraint.ConstraintLayou
This is how I want my layout to be
If you don't understand Constraints. You can use regular LinearLayout.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="10dp"
tools:context=".MainActivity"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="90dp"
>
<james.view.VideoView
android:id="#+id/remoteVideoView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
/>
<james.view.VideoView
android:id="#+id/localVideoView"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_weight="1"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
>
<Button
android:id="#+id/startVideoButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Start Call"/>
<Button
android:id="#+id/stopVideoButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="End Call"/>
<Button
android:id="#+id/sendmessage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="msg"/>
</LinearLayout>
<ListView
android:id="#+id/errorList"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
>
</ListView>
</LinearLayout>
Quite simple!
Solution:
This is exactly how you want, Just copy paste and your job is done:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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"
tools:context=".MainActivity">
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/linearLayout2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<james.view.VideoView
android:id="#+id/remoteVideoView"
android:layout_width="120dp"
android:layout_height="90dp"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="#+id/localVideoView"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<james.view.VideoView
android:id="#+id/localVideoView"
android:layout_width="120dp"
android:layout_height="90dp"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="#+id/remoteVideoView"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
<LinearLayout
android:id="#+id/linearLayout3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/linearLayout2">
<Button
android:id="#+id/startVideoButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Start Call" />
<Button
android:id="#+id/stopVideoButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="End Call" />
<Button
android:id="#+id/sendmessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="msg" />
</LinearLayout>
<ListView
android:id="#+id/errorList"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/linearLayout3">
</ListView>
</android.support.constraint.ConstraintLayout>
Try it. Hope it helps.
This is a sample xml, similar to your image. Since your code uses constraintLayout I have created the xml using constraintLayout instead of linear layout. I have created this from the design screen and not from the text screen. This is the xml `
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<Button
android:id="#+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="49dp"
android:layout_marginStart="49dp"
android:layout_marginTop="32dp"
android:text="Button"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="#+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="67dp"
android:layout_marginRight="67dp"
android:layout_marginTop="32dp"
android:text="Button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="#+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="193dp"
android:text="Button"
app:layout_constraintEnd_toEndOf="#+id/button"
app:layout_constraintStart_toStartOf="#+id/button"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="#+id/button4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="29dp"
android:layout_marginStart="29dp"
android:text="Button"
app:layout_constraintBaseline_toBaselineOf="#+id/button3"
app:layout_constraintStart_toEndOf="#+id/button3" />
<Button
android:id="#+id/button5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="35dp"
android:layout_marginEnd="17dp"
android:layout_marginRight="17dp"
android:layout_marginTop="193dp"
android:text="Button"
app:layout_constraintBottom_toTopOf="#+id/recyclerView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerView"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="19dp"
android:layout_marginEnd="22dp"
android:layout_marginLeft="22dp"
android:layout_marginRight="22dp"
android:layout_marginStart="22dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/button5" />
</android.support.constraint.ConstraintLayout>
`
Please see if this helps you. This is not exact screen as per your requirements.
I have a ViewPager activity that uses CoordinatorLayout and a couple of tabs. In each tab, I have these pretty large Fragments that will not fit all the way onto a user's screen. I want the user to be able to scroll up and down to see the entire Fragment. I obviously also want the scroll events to be picked up by CoordinatorLayout which will hide the Toolbar. I have the Toolbar hiding on scroll working, but after the Toolbar is hidden from the CoordinatorLayout scroll, I cannot scroll anymore to see the rest of my view below.
How can I get this behavior?
Here is my simple ViewPager activity layout
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.cryptobuddy.ryanbridges.cryptobuddy.currencylist.CurrencyListTabsActivity"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/appBarLayout"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar_currency_details"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light"
app:layout_scrollFlags="scroll|enterAlways|snap"/>
<android.support.design.widget.TabLayout
android:id="#+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="#+id/currencyTabsViewPager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
app:layout_behavior="#string/appbar_scrolling_view_behavior"/>
Here is my Fragment layout that I cannot for the life of me get to scroll:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.cryptobuddy.ryanbridges.cryptobuddy.chartandprice.CurrencyDetailsTabsActivity"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
android:fillViewport="true">
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/swipe_refresh_layout"
android:layout_gravity="center|bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<android.support.constraint.ConstraintLayout 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:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/graph_fragment_horizontal_margin"
android:paddingRight="#dimen/graph_fragment_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context="com.cryptobuddy.ryanbridges.cryptobuddy.chartandprice.CurrencyDetailsTabsActivity">
<TextView
android:id="#+id/current_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/graphFragmentDateTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:textSize="12sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.501"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/current_price" />
<TextView
android:id="#+id/percent_change"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:textSize="12sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/graphFragmentDateTextView" />
<com.github.mikephil.charting.charts.LineChart
android:id="#+id/chart"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="2dp"
android:layout_marginStart="2dp"
android:focusableInTouchMode="true"
android:padding="0dp"
app:layout_constraintBottom_toTopOf="#+id/guideline5"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="#+id/guideline6" />
<com.nex3z.togglebuttongroup.SingleSelectToggleGroup
android:id="#+id/chart_interval_button_grp"
android:layout_width="384dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toTopOf="#+id/guideline6"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/percent_change"
app:tbgCheckedButton="#+id/dayButton"
app:tbgChildSpacing="auto">
<com.nex3z.togglebuttongroup.button.CircularToggle
android:id="#+id/dayButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/oneDay"
android:textSize="16sp"
app:tbgMarkerColor="#color/colorAccent" />
<com.nex3z.togglebuttongroup.button.CircularToggle
android:id="#+id/weekButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/Week"
android:textSize="16sp"
app:tbgMarkerColor="#color/colorAccent" />
<com.nex3z.togglebuttongroup.button.CircularToggle
android:id="#+id/monthButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/Month"
android:textSize="16sp"
app:tbgMarkerColor="#color/colorAccent" />
<com.nex3z.togglebuttongroup.button.CircularToggle
android:id="#+id/threeMonthButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/threeMonth"
android:textSize="16sp"
app:tbgMarkerColor="#color/colorAccent" />
<com.nex3z.togglebuttongroup.button.CircularToggle
android:id="#+id/yearButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/Year"
android:textSize="16sp"
app:tbgMarkerColor="#color/colorAccent" />
<com.nex3z.togglebuttongroup.button.CircularToggle
android:id="#+id/allTimeButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/All"
android:textSize="16sp"
app:tbgMarkerColor="#color/colorAccent" />
</com.nex3z.togglebuttongroup.SingleSelectToggleGroup>
<android.support.constraint.Guideline
android:id="#+id/guideline5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.5" />
<android.support.constraint.Guideline
android:id="#+id/guideline6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.15" />
<TableLayout
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/guideline5">
<TableRow
android:id="#+id/nameTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/tableNameTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Name" />
<TextView
android:id="#+id/tableNameDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="TextView"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/symbolTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/tableSymbolTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Symbol" />
<TextView
android:id="#+id/tableSymbolDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="TextView"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/priceUSDTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/tablePriceUSDTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Price (USD)" />
<TextView
android:id="#+id/tablePriceUSDDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="TextView"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/priceBTCTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/tablePriceBTCTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Price (BTC)" />
<TextView
android:id="#+id/tablePriceBTCDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="TextView"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/volUSDTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/tableVolUSDTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="24h Volume" />
<TextView
android:id="#+id/tableVolUSDDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="TextView"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/mktCapUSDTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/tableMktCapTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Market Cap" />
<TextView
android:id="#+id/tableMktCapDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="TextView"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/availableSupplyTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/tableAvailableSupplyTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Available Supply" />
<TextView
android:id="#+id/tableAvailableSupplyDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="TextView"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/totalSupplyTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/tableTotalSupplyTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Total Supply" />
<TextView
android:id="#+id/tableTotalSupplyDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="TextView"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/maxSupplyTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/tableMaxSupplyTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Max Supply" />
<TextView
android:id="#+id/tableMaxSupplyDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="TextView"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/changeTitlesTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/table1hrChangeTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Change 1hr"
android:textAlignment="center" />
<TextView
android:id="#+id/table24hrChangeTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="Change 24hr"
android:textAlignment="center" />
<TextView
android:id="#+id/tableWeekChangeTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="3"
android:text="Change 7d"
android:textAlignment="center" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/table1hrChangeDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="TextView"
android:textAlignment="center" />
<TextView
android:id="#+id/table24hrChangeDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="TextView"
android:textAlignment="center" />
<TextView
android:id="#+id/table7dChangeDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="3"
android:text="TextView"
android:textAlignment="center" />
</TableRow>
</TableLayout>
</android.support.constraint.ConstraintLayout>
</ScrollView>
</android.support.v4.widget.SwipeRefreshLayout>
From your fragment code:
Remove the outermost NestedScrollView. You don't need it.
Add app:layout_behavior="#string/appbar_scrolling_view_behavior" to the SwipeRefreshLayout which has become the new parent.
Change the inner ScrollView to NestedScrollView.
Let us know if it works.
I found the solution. There were 2 problems:
I was using guidelines in the ConstraintLayout.
I had the height/width of some elements in my ConstraintLayout set to match_constraint.
I removed the guidelines and gave all of my layout elements raw height/width values in dp. That seems to have fixed the problem.
It seems that the scrolling does not play nicely fitting elements inside of guidelines
Here is my xml now:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/graphFragmentNestedScrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="#dimen/graph_fragment_horizontal_margin"
android:paddingRight="#dimen/graph_fragment_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin">
<TextView
android:id="#+id/current_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/graphFragmentDateTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:textSize="12sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/current_price" />
<TextView
android:id="#+id/percent_change"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:textSize="12sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/graphFragmentDateTextView" />
<com.nex3z.togglebuttongroup.SingleSelectToggleGroup
android:id="#+id/chart_interval_button_grp"
android:layout_width="362dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/percent_change"
app:tbgCheckedButton="#+id/dayButton"
app:tbgChildSpacing="auto">
<com.nex3z.togglebuttongroup.button.CircularToggle
android:id="#+id/dayButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/oneDay"
android:textSize="16sp"
app:tbgMarkerColor="#color/colorAccent" />
<com.nex3z.togglebuttongroup.button.CircularToggle
android:id="#+id/weekButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/Week"
android:textSize="16sp"
app:tbgMarkerColor="#color/colorAccent" />
<com.nex3z.togglebuttongroup.button.CircularToggle
android:id="#+id/monthButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/Month"
android:textSize="16sp"
app:tbgMarkerColor="#color/colorAccent" />
<com.nex3z.togglebuttongroup.button.CircularToggle
android:id="#+id/threeMonthButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/threeMonth"
android:textSize="16sp"
app:tbgMarkerColor="#color/colorAccent" />
<com.nex3z.togglebuttongroup.button.CircularToggle
android:id="#+id/yearButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/Year"
android:textSize="16sp"
app:tbgMarkerColor="#color/colorAccent" />
<com.nex3z.togglebuttongroup.button.CircularToggle
android:id="#+id/allTimeButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/All"
android:textSize="16sp"
app:tbgMarkerColor="#color/colorAccent" />
</com.nex3z.togglebuttongroup.SingleSelectToggleGroup>
<com.github.mikephil.charting.charts.LineChart
android:id="#+id/chart"
android:layout_width="match_parent"
android:layout_height="275dp"
android:layout_marginTop="8dp"
android:focusableInTouchMode="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/chart_interval_button_grp" />
<TableLayout
android:id="#+id/tableLayoutGraphFragment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:paddingBottom="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/chart">
<TableRow
android:id="#+id/nameTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/lightGray">
<TextView
android:id="#+id/tableNameTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="8dp"
android:text="Name" />
<TextView
android:id="#+id/tableNameDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:paddingEnd="8dp"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/priceUSDTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/tablePriceUSDTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="8dp"
android:text="Price (USD)" />
<TextView
android:id="#+id/tablePriceUSDDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:paddingEnd="8dp"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/priceBTCTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/lightGray">
<TextView
android:id="#+id/tablePriceBTCTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="8dp"
android:text="Price (BTC)" />
<TextView
android:id="#+id/tablePriceBTCDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:paddingEnd="8dp"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/volUSDTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/tableVolUSDTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="8dp"
android:text="24h Volume" />
<TextView
android:id="#+id/tableVolUSDDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:paddingEnd="8dp"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/mktCapUSDTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/lightGray">
<TextView
android:id="#+id/tableMktCapTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="8dp"
android:text="Market Cap" />
<TextView
android:id="#+id/tableMktCapDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:paddingEnd="8dp"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/availableSupplyTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/tableAvailableSupplyTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="8dp"
android:text="Available Supply" />
<TextView
android:id="#+id/tableAvailableSupplyDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:paddingEnd="8dp"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/totalSupplyTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/lightGray">
<TextView
android:id="#+id/tableTotalSupplyTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="8dp"
android:text="Total Supply" />
<TextView
android:id="#+id/tableTotalSupplyDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:paddingEnd="8dp"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/maxSupplyTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/tableMaxSupplyTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="8dp"
android:text="Max Supply" />
<TextView
android:id="#+id/tableMaxSupplyDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:paddingEnd="8dp"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/changeTitlesTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/lightGray">
<TextView
android:id="#+id/table1hrChangeTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="8dp"
android:text="Change 1hr"
android:textAlignment="center" />
<TextView
android:id="#+id/table24hrChangeTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:paddingStart="8dp"
android:text="Change 24hr"
android:textAlignment="center" />
<TextView
android:id="#+id/tableWeekChangeTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="3"
android:paddingStart="8dp"
android:text="Change 7d"
android:textAlignment="center" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/lightGray">
<TextView
android:id="#+id/table1hrChangeDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingEnd="8dp"
android:textAlignment="center"
android:textStyle="bold" />
<TextView
android:id="#+id/table24hrChangeDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:paddingEnd="8dp"
android:textAlignment="center"
android:textStyle="bold" />
<TextView
android:id="#+id/tableWeekChangeDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="3"
android:paddingEnd="8dp"
android:textAlignment="center"
android:textStyle="bold" />
</TableRow>
</TableLayout>
</android.support.constraint.ConstraintLayout>