On my ListView some lines are not RTL aligned.
After scrolling and redrawing the lines are correct.
My layout of the line item:
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/clFrontView"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:paddingLeft="16dp"
android:paddingRight="16dp">
<ImageView
android:id="#+id/ivCircle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/circle"
tools:ignore="ContentDescription"
android:layout_marginTop="5dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintLeft_toLeftOf="parent" />
<ImageView
android:id="#+id/ivReminderType"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
tools:ignore="ContentDescription"
app:layout_constraintTop_toTopOf="#id/ivCircle"
app:layout_constraintBottom_toBottomOf="#id/ivCircle"
app:layout_constraintStart_toStartOf="#id/ivCircle"
app:layout_constraintEnd_toEndOf="#id/ivCircle"
app:layout_constraintLeft_toLeftOf="#id/ivCircle"
app:layout_constraintRight_toRightOf="#id/ivCircle" />
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/civContactImage"
android:layout_width="42dp"
android:layout_height="42dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
<ImageView
android:id="#+id/icivCircleSmall"
android:layout_width="15dp"
android:layout_height="15dp"
app:layout_constraintEnd_toEndOf="#id/civContactImage"
app:layout_constraintRight_toRightOf="#id/civContactImage"
app:layout_constraintBottom_toBottomOf="#id/civContactImage"
tools:ignore="ContentDescription"/>
<TextView
android:id="#+id/tvTextLine"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
tools:text="Line of Text"
android:textSize="18sp"
android:maxLines="2"
app:layout_constraintLeft_toRightOf="#id/ivCircle"
app:layout_constraintStart_toEndOf="#id/ivCircle"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"/>
<TextView
android:id="#+id/tvTextLine2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:textSize="16sp"
android:visibility="gone"
app:layout_constraintStart_toStartOf="#id/tvTextLine"
app:layout_constraintLeft_toLeftOf="#id/tvTextLine"
app:layout_constraintTop_toBottomOf="#id/tvTextLine" />
<TextView
android:id="#+id/tvTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
tools:text="Wed, 01.05.2018 10:10"
android:textColor="#FF909090"
android:textSize="12sp"
android:drawablePadding="5dp"
app:layout_constraintStart_toStartOf="#id/tvTextLine"
app:layout_constraintLeft_toLeftOf="#id/tvTextLine"
app:layout_constraintTop_toBottomOf="#id/tvTextLine2" />
<TextView
android:id="#+id/tvRepeat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
tools:text="Every 2nd Friday"
android:textColor="#FF909090"
android:textSize="12sp"
android:drawablePadding="5dp"
app:layout_constraintStart_toStartOf="#id/tvTextLine"
app:layout_constraintLeft_toLeftOf="#id/tvTextLine"
app:layout_constraintTop_toBottomOf="#id/tvTime" />
</android.support.constraint.ConstraintLayout>
First start it looks like this, the first line is not RTL:
After scrolling down and again up to the top it is correct:
build.gradle dependency:
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
These changes may work:
<ImageView
android:id="#+id/ivCircle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/bg_circle_win"
app:layout_constraintBottom_toBottomOf="#+id/civContactImage"
app:layout_constraintStart_toStartOf="#+id/civContactImage"
tools:ignore="ContentDescription" />
<ImageView
android:id="#+id/ivReminderType"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
app:layout_constraintEnd_toEndOf="#+id/civContactImage"
app:layout_constraintTop_toTopOf="#+id/civContactImage"
tools:ignore="ContentDescription" />
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/civContactImage"
android:layout_width="42dp"
android:layout_height="42dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="#+id/icivCircleSmall"
android:layout_width="15dp"
android:layout_height="15dp"
app:layout_constraintEnd_toEndOf="#id/civContactImage"
app:layout_constraintRight_toRightOf="#id/civContactImage"
app:layout_constraintBottom_toBottomOf="#id/civContactImage"
tools:ignore="ContentDescription"/>
<TextView
android:id="#+id/tvTextLine"
android:layout_width="wrap_content"
android:layout_height="23dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:gravity="center_vertical"
android:maxLines="2"
android:textSize="18sp"
app:layout_constraintEnd_toStartOf="#+id/civContactImage"
tools:text="Line of Text" />
<TextView
android:id="#+id/tvTextLine2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:textSize="16sp"
android:visibility="gone" />
<TextView
android:id="#+id/tvTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:drawablePadding="5dp"
android:gravity="center_vertical"
android:textColor="#FF909090"
android:textSize="12sp"
app:layout_constraintEnd_toStartOf="#+id/civContactImage"
app:layout_constraintTop_toBottomOf="#+id/tvTextLine"
tools:text="Wed, 01.05.2018 10:10" />
<TextView
android:id="#+id/tvRepeat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:drawablePadding="5dp"
android:gravity="center_vertical"
android:textColor="#FF909090"
android:textSize="12sp"
app:layout_constraintEnd_toStartOf="#+id/civContactImage"
app:layout_constraintTop_toBottomOf="#+id/tvTime"
tools:text="Every 2nd Friday" />
I hope to work. good luck
Try this maybe it could solve the problem. Small testing changes are there you can remove them according to your need, Firstly, I have changed the tools:text to android:text so that it shows dummy data.Secondly, The two imageview named as ivReminderType and icivCircleSmall I have put two default images just for testing purpose so do change that. Also there is one imageview named icivCircleSmall I didnt know where it should be constarined to so I have not edited any code written for it. Below is the edited code of the xml.
<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:id="#+id/clFrontView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="10dp">
<ImageView
android:id="#+id/ivCircle"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:src="#mipmap/ic_launcher"
app:layout_constraintBottom_toTopOf="#+id/tvRepeat"
app:layout_constraintEnd_toStartOf="#+id/tvTime"
app:layout_constraintTop_toBottomOf="#+id/tvTextLine"
tools:ignore="ContentDescription" />
<ImageView
android:id="#+id/ivReminderType"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:src="#mipmap/ic_launcher"
app:layout_constraintBottom_toBottomOf="#+id/tvRepeat"
app:layout_constraintEnd_toStartOf="#+id/tvRepeat"
app:layout_constraintTop_toBottomOf="#+id/tvTime"
tools:ignore="ContentDescription" />
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/civContactImage"
android:layout_width="42dp"
android:layout_height="42dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:src="#mipmap/ic_launcher"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="#+id/icivCircleSmall"
android:layout_width="15dp"
android:layout_height="15dp"
app:layout_constraintBottom_toBottomOf="#id/civContactImage"
app:layout_constraintEnd_toEndOf="#id/civContactImage"
app:layout_constraintRight_toRightOf="#id/civContactImage"
tools:ignore="ContentDescription" />
<TextView
android:id="#+id/tvTextLine"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:gravity="center_vertical"
android:maxLines="2"
android:text="Line of Text"
android:textSize="18sp"
app:layout_constraintEnd_toStartOf="#+id/civContactImage"
app:layout_constraintTop_toTopOf="#+id/civContactImage" />
<TextView
android:id="#+id/tvTextLine2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:textSize="16sp"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="#id/tvTextLine"
app:layout_constraintStart_toStartOf="#id/tvTextLine"
app:layout_constraintTop_toBottomOf="#id/tvTextLine" />
<TextView
android:id="#+id/tvTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:drawablePadding="5dp"
android:gravity="center_vertical"
android:text="Wed, 01.05.2018 10:10"
android:textColor="#FF909090"
android:textSize="12sp"
app:layout_constraintEnd_toStartOf="#+id/civContactImage"
app:layout_constraintTop_toBottomOf="#id/tvTextLine2" />
<TextView
android:id="#+id/tvRepeat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawablePadding="5dp"
android:gravity="center_vertical"
android:text="Every 2nd Friday"
android:textColor="#FF909090"
android:textSize="12sp"
app:layout_constraintEnd_toEndOf="#+id/tvTime"
app:layout_constraintLeft_toLeftOf="#id/tvTextLine"
app:layout_constraintStart_toStartOf="#id/tvTextLine"
app:layout_constraintTop_toBottomOf="#id/tvTime" />
</android.support.constraint.ConstraintLayout>
Hope it helps!
Related
I have a ScrollView that wraps a ConstraintLayout, the issue is that despite the ScrollView does match completely the screen, the Constraint doesn't. I have settled both to match_parent, but the ConstraintLayout doesn't fill around a 20% on the bottom as you can see in the image, the blue line of the bottom is the max height of my ConstraintLayout , I have read many articles but haven't been able to find an answer, I don't know if this is related to data-binding. Here my code `
<data>
<variable
name="bindingViewModel"
type="com.example.workoutstopwatch.MainActivityViewModel" />
</data>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/textView3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10sp"
android:layout_marginLeft="10sp"
android:layout_marginTop="10sp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:text="#string/set_your_work_out_time"
android:textSize="30sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="#+id/edit_work_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="8dp"
android:layout_weight="3"
android:hint="#string/_00"
android:inputType="number"
android:maxLength="2"
android:text="#={bindingViewModel.workOutTime}"
android:textSize="80sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView3" />
<Button
android:id="#+id/up_arrow_work"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_gravity="top"
android:layout_marginStart="180dp"
android:layout_marginLeft="180dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="50dp"
android:layout_marginRight="50dp"
android:background="#drawable/arrow_left_foreground"
android:onClick="setDurationType"
android:rotation="90"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="#+id/edit_work_text"
app:layout_constraintTop_toBottomOf="#+id/textView3" />
<TextView
android:id="#+id/work_min_or_secs_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/up_arrow_work"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginTop="52dp"
android:hint="Secs"
android:text="#{bindingViewModel.workMinOrSecsText}"
android:textSize="30sp"
app:layout_constraintBottom_toBottomOf="#+id/down_arrow_work"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.739"
app:layout_constraintStart_toEndOf="#+id/edit_work_text"
app:layout_constraintTop_toBottomOf="#+id/textView3"
app:layout_constraintVertical_bias="0.0" />
<Button
android:id="#+id/down_arrow_work"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_gravity="top"
android:layout_marginStart="180dp"
android:layout_marginLeft="180dp"
android:layout_marginTop="40dp"
android:layout_marginEnd="50dp"
android:layout_marginRight="50dp"
android:background="#drawable/arrow_left_foreground"
android:onClick="setDurationType"
android:rotation="90"
android:rotationX="189"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.983"
app:layout_constraintStart_toEndOf="#+id/edit_work_text"
app:layout_constraintTop_toBottomOf="#+id/up_arrow_work" />
<TextView
android:id="#+id/textView4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="197dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="163dp"
android:text="#string/set_your_rest_time"
android:textSize="30sp"
app:layout_constraintBottom_toTopOf="#+id/textView5"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.304"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="#+id/edit_rest_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="12dp"
android:layout_weight="3"
android:hint="#string/_00"
android:inputType="number"
android:maxLength="2"
android:text="#={bindingViewModel.restTime}"
android:textSize="80sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView4" />
<Button
android:id="#+id/up_arrow_rest"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_gravity="top"
android:layout_marginStart="180dp"
android:layout_marginLeft="180dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="50dp"
android:layout_marginRight="50dp"
android:background="#drawable/arrow_left_foreground"
android:onClick="setDurationType"
android:rotation="90"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="#+id/edit_rest_text"
app:layout_constraintTop_toBottomOf="#+id/textView4" />
<TextView
android:id="#+id/rest_min_or_secs_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/up_arrow_work"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginTop="52dp"
android:hint="Secs"
android:text="#{bindingViewModel.restMinOrSecsText}"
android:textSize="30sp"
app:layout_constraintBottom_toBottomOf="#+id/down_arrow_rest"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.739"
app:layout_constraintStart_toEndOf="#+id/edit_rest_text"
app:layout_constraintTop_toBottomOf="#+id/textView4"
app:layout_constraintVertical_bias="0.0" />
<Button
android:id="#+id/down_arrow_rest"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_gravity="top"
android:layout_marginStart="180dp"
android:layout_marginLeft="180dp"
android:layout_marginTop="40dp"
android:layout_marginEnd="50dp"
android:layout_marginRight="50dp"
android:background="#drawable/arrow_left_foreground"
android:onClick="setDurationType"
android:rotation="90"
android:rotationX="189"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.983"
app:layout_constraintStart_toEndOf="#+id/edit_rest_text"
app:layout_constraintTop_toBottomOf="#+id/up_arrow_rest" />
<TextView
android:id="#+id/textView5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="168dp"
android:text="#string/set_your_number_of_reps"
android:textSize="30sp"
app:layout_constraintBottom_toTopOf="#+id/start_text"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.611"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView4" />
<EditText
android:id="#+id/edit_reps_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="16dp"
android:layout_weight="3"
android:hint="#string/_00"
android:inputType="number"
android:maxLength="2"
android:text="#={bindingViewModel.numberOfReps}"
android:textSize="80sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView5" />
<TextView
android:id="#+id/start_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:gravity="center"
android:onClick="startTraining"
android:text="START!"
android:textColor="#FF1800"
android:textSize="60sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
`
This is my first ask on StackOverflow. a Greetings.
I am using Android Studio, I'm trying to make a Layout that the textView is just below and centered on another TextView. Actually, I have it like this.
Want to ask how I can do something like this:
To center it and be "responsive" with the superior text view. Thank you so much.
this is the code:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:padding="#dimen/activity_horizontal_margin">
<ImageView
android:id="#+id/imgPartidasRecomendaciones"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="#dimen/activity_horizontal_margin"
android:src="#drawable/ic_star" />
<TextView
android:id="#+id/tv_perfil_partidasJugadas"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/activity_horizontal_margin"
android:layout_toEndOf="#id/imgPartidasRecomendaciones"
android:background="#android:color/transparent"
android:text="Partidas"
android:textAppearance="#style/TextAppearance.AppCompat.Small"
android:textColor="#727272" />
<TextView
android:id="#+id/tv_perfil_recomendaciones"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="60dp"
android:layout_toEndOf="#id/tv_perfil_partidasJugadas"
android:background="#android:color/transparent"
android:text="Recomendaciones"
android:textAppearance="#style/TextAppearance.AppCompat.Small"
android:textColor="#727272" />
<TextView
android:id="#+id/tv_partidasJugadasNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/tv_perfil_partidasJugadas"
android:layout_alignParentBottom="true"
android:layout_marginStart="#dimen/activity_horizontal_margin"
android:layout_toEndOf="#id/imgPartidasRecomendaciones"
android:layout_marginBottom="10dp"
android:text="0"
android:textAlignment="center"
android:textAppearance="#style/TextAppearance.AppCompat.Medium"
android:textColor="#212121"
android:textSize="20sp" />
<TextView
android:id="#+id/tv_recomendacionesNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/tv_perfil_partidasJugadas"
android:layout_alignParentBottom="true"
android:layout_marginStart="60dp"
android:layout_toEndOf="#id/tv_partidasJugadasNumber"
android:layout_marginBottom="10dp"
android:text="0"
android:textAlignment="center"
android:textAppearance="#style/TextAppearance.AppCompat.Medium"
android:textColor="#212121"
android:textSize="20sp" />
</RelativeLayout>
The solution is to wrap each pair of TextViews inside a vertical LinearLayout:
<ImageView
android:id="#+id/imgPartidasRecomendaciones"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="#dimen/activity_horizontal_margin"
android:src="#drawable/ic_star" />
<LinearLayout
android:id="#+id/leftLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/activity_horizontal_margin"
android:layout_marginBottom="10dp"
android:layout_toEndOf="#id/imgPartidasRecomendaciones"
android:orientation="vertical">
<TextView
android:id="#+id/tv_perfil_partidasJugadas"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#android:color/transparent"
android:text="Partidas"
android:textAppearance="#style/TextAppearance.AppCompat.Small"
android:textColor="#727272" />
<TextView
android:id="#+id/tv_partidasJugadasNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="#dimen/activity_horizontal_margin"
android:text="0"
android:textAlignment="center"
android:textAppearance="#style/TextAppearance.AppCompat.Medium"
android:textColor="#212121"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/rightLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_toEndOf="#id/leftLayout"
android:layout_marginStart="60dp"
android:layout_marginBottom="10dp">
<TextView
android:id="#+id/tv_perfil_recomendaciones"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#android:color/transparent"
android:text="Recomendaciones"
android:textAppearance="#style/TextAppearance.AppCompat.Small"
android:textColor="#727272" />
<TextView
android:id="#+id/tv_recomendacionesNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="60dp"
android:text="0"
android:textAlignment="center"
android:textAppearance="#style/TextAppearance.AppCompat.Medium"
android:textColor="#212121"
android:textSize="20sp" />
</LinearLayout>
</RelativeLayout>
You can put every pair of textViews inside vertical LinearLayout but you better use constraint layout - it is a better layout for responsive screen building and easy to integrate with, here is a good example of using it:
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:background="#color/buttonColor"
android:text="view"
android:textColor="#color/textMainColour"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="#+id/guideline2"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="19dp"
android:layout_marginStart="20dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:background="#color/buttonColor"
android:text="view"
android:textColor="#color/textMainColour"
app:layout_constraintBottom_toTopOf="#+id/textView10"
app:layout_constraintEnd_toStartOf="#+id/guideline3"
app:layout_constraintStart_toStartOf="#+id/guideline2" />
<TextView
android:id="#+id/textView5"
android:layout_width="0dp"
android:layout_height="21dp"
android:layout_marginTop="8dp"
android:background="#color/buttonColor"
android:text="view"
android:textColor="#color/textMainColour"
app:layout_constraintEnd_toEndOf="#+id/textView4"
app:layout_constraintStart_toStartOf="#+id/textView4"
app:layout_constraintTop_toBottomOf="#+id/textView10" />
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#color/buttonColor"
android:text="view"
android:textColor="#color/textMainColour"
app:layout_constraintBottom_toBottomOf="#+id/textView5"
app:layout_constraintEnd_toEndOf="#+id/textView8"
app:layout_constraintStart_toStartOf="#+id/textView8"
app:layout_constraintTop_toTopOf="#+id/textView5"
app:layout_constraintVertical_bias="0.0" />
<androidx.constraintlayout.widget.Guideline
android:id="#+id/guideline2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_begin="55dp"
app:layout_constraintGuide_percent="0.2" />
<androidx.constraintlayout.widget.Guideline
android:id="#+id/guideline3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_begin="146dp"
app:layout_constraintGuide_percent="0.6" />
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:background="#color/buttonColor"
android:text="view"
android:textColor="#color/textMainColour"
app:layout_constraintBottom_toBottomOf="#+id/textView4"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#+id/textView4"
app:layout_constraintTop_toTopOf="#+id/textView4" />
</androidx.constraintlayout.widget.ConstraintLayout>
You can nest multiple layouts (LinearLayout, RelativeLayout, CoordinatorLayout) to achieve what you want.
If I understand what you asked, you are probably looking for something like this:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:padding="16dp"
xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout
android:id="#+id/rl1"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/imgPartidasRecomendaciones"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
android:src="#drawable/ic_launcher_foreground" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/rl2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toEndOf="#+id/rl1"
android:layout_toRightOf="#+id/rl1">
<TextView
android:id="#+id/tv_perfil_partidasJugadas"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:background="#android:color/transparent"
android:text="Partidas"
android:textAppearance="#style/TextAppearance.AppCompat.Small"
android:textColor="#727272" />
<TextView
android:id="#+id/tv_partidasJugadasNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginBottom="10dp"
android:layout_below="#id/tv_perfil_partidasJugadas"
android:layout_centerInParent="true"
android:text="0"
android:textAlignment="center"
android:textAppearance="#style/TextAppearance.AppCompat.Medium"
android:textColor="#212121"
android:textSize="20sp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/rl3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toEndOf="#+id/rl2"
android:layout_toRightOf="#+id/rl2">
<TextView
android:id="#+id/tv_perfil_recomendaciones"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="60dp"
android:layout_marginLeft="60dp"
android:background="#android:color/transparent"
android:text="Recomendaciones"
android:textAppearance="#style/TextAppearance.AppCompat.Small"
android:textColor="#727272" />
<TextView
android:id="#+id/tv_recomendacionesNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/tv_perfil_recomendaciones"
android:layout_alignParentBottom="true"
android:layout_marginStart="60dp"
android:layout_marginLeft="60dp"
android:layout_marginBottom="10dp"
android:text="0"
android:layout_centerInParent="true"
android:textAlignment="center"
android:textAppearance="#style/TextAppearance.AppCompat.Medium"
android:textColor="#212121"
android:textSize="20sp" />
</RelativeLayout>
</RelativeLayout>
I suggest you to use Constraint Layout to build better responsive layouts (easier).
Searched around, can't find this issue specifically. Created an account specifically to ask WHAT'S HAPPENING HERE?!
Using a ConstraintLayout for the first time - I've had good success, but for some reason CANNOT get two of my Components to play nicely.
Here's what I WANT it to look like (accomplished by breaking constraints and hardcoding stuff):
...and here's the jumbled mess I get if I try to constrain "LabelJournal" and "linearLayout2":
The problems are happening for components named "LabelJournal" and "linearLayout2". Here's what my LayoutFile looks like... It's a WIP so I know right now there's a lot of hardcoding of text values and whatnot - I'm just trying to figure out WHAT in the world is causing these two components to get stuck at the top of the parent:
<?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">
<ImageButton
android:id="#+id/imageButton"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="#android:color/transparent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/ic_left" />
<EditText
android:id="#+id/editText"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_marginEnd="14dp"
android:layout_marginStart="14dp"
android:inputType="date"
android:text="03/04/2018"
android:textAlignment="center"
android:textSize="24sp"
app:layout_constraintEnd_toStartOf="#+id/imageButton2"
app:layout_constraintStart_toEndOf="#+id/imageButton"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="#+id/imageButton2"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="#android:color/transparent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/ic_right" />
<TextView
android:id="#+id/LabelJournal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:text="Journal:"
android:textStyle="italic"
app:layout_constraintBottom_toTopOf="#id/ContentJournal"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/imageButton" />
<TextView
android:id="#+id/ContentJournal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:text="The journal text would go in right about here. It should wrap to the next line for sufficientyl large text blocks."
android:textColorLink="#android:color/black"
android:textSize="18sp"
app:layout_constraintBottom_toTopOf="#+id/LabelTags"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/LabelJournal" />
<TextView
android:id="#+id/LabelTags"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginStart="16dp"
android:text="Tags:"
android:textStyle="italic"
app:layout_constraintBottom_toTopOf="#+id/horizontalScrollView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="#id/ContentJournal" />
<HorizontalScrollView
android:id="#+id/horizontalScrollView"
android:layout_width="0dp"
android:layout_height="41dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/LabelTags">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:id="#+id/TagDayOff"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical|center_horizontal"
android:padding="10dp"
android:paddingBottom="15dp"
android:paddingTop="15dp"
android:text="#DayOff"
android:textAlignment="center"
android:textColor="#android:color/darker_gray"
android:textSize="18sp" />
<TextView
android:id="#+id/TagUntracked"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical|center_horizontal"
android:padding="10dp"
android:paddingBottom="15dp"
android:paddingTop="15dp"
android:text="#Untracked"
android:textAlignment="center"
android:textColor="#android:color/darker_gray"
android:textSize="18sp" />
<TextView
android:id="#+id/TagTravel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical|center_horizontal"
android:padding="10dp"
android:paddingBottom="15dp"
android:paddingTop="15dp"
android:text="#Travel"
android:textAlignment="center"
android:textColor="#android:color/darker_gray"
android:textSize="18sp" />
<TextView
android:id="#+id/TagGames"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical|center_horizontal"
android:padding="10dp"
android:paddingBottom="15dp"
android:paddingTop="15dp"
android:text="#Games"
android:textAlignment="center"
android:textColor="#android:color/darker_gray"
android:textSize="18sp" />
<TextView
android:id="#+id/TagMovie"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical|center_horizontal"
android:padding="10dp"
android:paddingBottom="15dp"
android:paddingTop="15dp"
android:text="#Games"
android:textAlignment="center"
android:textColor="#android:color/darker_gray"
android:textSize="18sp" />
</LinearLayout>
</HorizontalScrollView>
<TextView
android:id="#+id/LabelDIet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:text="Diet:"
android:textStyle="italic"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/horizontalScrollView" />
<TextView
android:id="#+id/ContentCalories"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginTop="8dp"
android:textSize="18sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/LabelDIet"
tools:text="2813" />
<TextView
android:id="#+id/DietCalLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:text="Cal"
android:textSize="10sp"
android:textStyle="italic"
app:layout_constraintBottom_toBottomOf="#+id/ContentCalories"
app:layout_constraintStart_toEndOf="#+id/ContentCalories" />
<ProgressBar
android:id="#+id/ProgressCalories"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="2dp"
android:layout_marginEnd="-8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="2dp"
android:progressDrawable="#android:color/holo_blue_dark"
android:progressTint="#android:color/holo_green_light"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="#+id/ContentCalories"
app:layout_constraintEnd_toEndOf="#+id/ContentProteinPercent"
app:layout_constraintStart_toEndOf="#+id/DietCalLabel"
app:layout_constraintTop_toTopOf="#+id/ContentCalories" />
<TextView
android:id="#+id/ContentProtein"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginTop="8dp"
android:textSize="18sp"
app:layout_constraintEnd_toStartOf="#+id/DietCalLabel"
app:layout_constraintTop_toBottomOf="#+id/ContentCalories"
tools:text="154" />
<TextView
android:id="#+id/DietProteinLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:text="P"
android:textSize="10sp"
android:textStyle="italic"
app:layout_constraintBottom_toBottomOf="#+id/ContentProtein"
app:layout_constraintStart_toEndOf="#+id/ContentProtein" />
<ProgressBar
android:id="#+id/ProgressProtein"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="150dp"
android:layout_height="0dp"
android:layout_marginBottom="4dp"
android:layout_marginStart="8dp"
android:layout_marginTop="4dp"
android:progressDrawable="#android:color/holo_blue_dark"
android:progressTint="#android:color/holo_red_light"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="#+id/ContentProtein"
app:layout_constraintStart_toEndOf="#+id/DietCalLabel"
app:layout_constraintTop_toTopOf="#+id/ContentProtein" />
<TextView
android:id="#+id/ContentProteinPercent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:paddingEnd="8dp"
android:paddingStart="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.074"
app:layout_constraintStart_toEndOf="#+id/ProgressProtein"
app:layout_constraintTop_toTopOf="#+id/ContentProtein"
tools:text="22 %" />
<TextView
android:id="#+id/ContentFat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginTop="8dp"
android:textSize="18sp"
app:layout_constraintEnd_toStartOf="#+id/DietCalLabel"
app:layout_constraintTop_toBottomOf="#+id/ContentProtein"
tools:text="103" />
<TextView
android:id="#+id/dietProteinLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:text="F"
android:textSize="10sp"
android:textStyle="italic"
app:layout_constraintBottom_toBottomOf="#+id/ContentFat"
app:layout_constraintStart_toEndOf="#+id/ContentFat" />
<ProgressBar
android:id="#+id/ProgressFats"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="150dp"
android:layout_height="0dp"
android:layout_marginBottom="4dp"
android:layout_marginStart="8dp"
android:layout_marginTop="4dp"
android:progressDrawable="#android:color/holo_blue_dark"
android:progressTint="#android:color/holo_orange_light"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="#+id/ContentFat"
app:layout_constraintStart_toEndOf="#+id/DietCalLabel"
app:layout_constraintTop_toTopOf="#+id/ContentFat" />
<TextView
android:id="#+id/contentProteinPercent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:paddingEnd="8dp"
android:paddingStart="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.074"
app:layout_constraintStart_toEndOf="#+id/ProgressProtein"
app:layout_constraintTop_toTopOf="#+id/ContentFat"
tools:text="33 %" />
<TextView
android:id="#+id/ContentCarbs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginTop="8dp"
android:textSize="18sp"
app:layout_constraintEnd_toStartOf="#+id/DietCalLabel"
app:layout_constraintTop_toBottomOf="#+id/ContentFat"
tools:text="302" />
<TextView
android:id="#+id/DietCarbLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:text="C"
android:textSize="10sp"
android:textStyle="italic"
app:layout_constraintBottom_toBottomOf="#+id/ContentCarbs"
app:layout_constraintStart_toEndOf="#+id/ContentCarbs" />
<ProgressBar
android:id="#+id/ProgressCarbs"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="150dp"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:layout_marginStart="8dp"
android:progressDrawable="#android:color/holo_blue_dark"
android:progressTint="#android:color/holo_blue_light"
android:visibility="visible"
app:layout_constraintBottom_toBottomOf="#+id/ContentCarbs"
app:layout_constraintStart_toEndOf="#+id/DietCalLabel"
app:layout_constraintTop_toTopOf="#+id/ContentCarbs" />
<TextView
android:id="#+id/ContentCarbPercent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:paddingEnd="8dp"
android:paddingStart="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.074"
app:layout_constraintStart_toEndOf="#+id/ProgressProtein"
app:layout_constraintTop_toTopOf="#+id/ContentCarbs"
tools:text="43 %" />
<TextView
android:id="#+id/LabelExercise"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:text="Exercise:"
android:textStyle="italic"
app:layout_constraintBottom_toTopOf="#+id/linearLayout2"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/ContentCarbs" />
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="436dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/LabelExercise" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageButton
android:id="#+id/ImageExerciseAttribution"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_weight="1"
android:background="#android:color/transparent"
android:scaleType="fitXY"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/LabelExercise"
app:srcCompat="#drawable/fit" />
<TextView
android:id="#+id/ContentExercise"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_weight="1"
android:text="45 min - PHUL Upper Power"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="#+id/ImageExerciseAttribution"
app:layout_constraintStart_toEndOf="#+id/ImageExerciseAttribution"
app:layout_constraintTop_toTopOf="#+id/ImageExerciseAttribution" />
</LinearLayout>
</LinearLayout>
</android.support.constraint.ConstraintLayout>
Perhaps I should also mention - I have no errors showing up in my Constraint Layout (although a ton of warnings about hardcoded text and whatnot that I'll deal with later).
Alright took me an hour of tinkering - but ever line in my Layout HTML that contains "layout_constraintBottom_toTopOf" caused the problem. I don't know if it's an ordering thing or some weird drawing hierarchy. It makes no sense to me how this got busted.
Hello I have an issue with my layout. Its working properly on preview mode and on an emulator with Api level 24 but when I run it on a device with api 19 it just breaks up and gets all messed up. Even my edit text fields end up unresponsive. here I paste my XML code to see if you guys coud help me out.
EDIT: I am very sorry I've pasted the wrong code (it was incomplete). I have edited and now its correct. Also attached a couple of pictures of how looks in the named devices.
Here is the messed layout And here is the correct one
.Another thing is that I am using one nested constraint layout. Do you thing that could be it?
<?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:id="#+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="true"
tools:context="com.cuantomefalta.cuantomefalta.MainActivity">
<EditText
android:id="#+id/weighing3"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center_vertical"
android:background="#drawable/little_square"
android:cursorVisible="false"
android:fontFamily="sans-serif-medium"
android:gravity="center"
android:hint="#string/cero_percent"
android:imeOptions="actionDone"
android:inputType="number"
android:textColor="#android:color/white"
android:textSize="25sp"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="#+id/weighing2"
tools:text="25%"
android:layout_marginLeft="8dp"
android:layout_marginTop="2dp"
android:layout_marginStart="8dp"/>
<EditText
android:id="#+id/grade3"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center_vertical"
android:background="#drawable/little_square"
android:cursorVisible="false"
android:fontFamily="sans-serif-medium"
android:gravity="center"
android:hint="#string/one"
android:imeOptions="actionDone"
android:inputType="number"
android:textColor="#android:color/white"
android:textSize="25sp"
android:visibility="gone"
app:layout_constraintLeft_toRightOf="#+id/weighing3"
app:layout_constraintRight_toLeftOf="#+id/converted3"
app:layout_constraintTop_toTopOf="#+id/weighing3"
tools:text="100" />
<TextView
android:id="#+id/converted3"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center_vertical"
android:background="#drawable/little_square"
android:fontFamily="sans-serif-medium"
android:gravity="center"
android:text="#string/one_point_cero"
android:textColor="#android:color/white"
android:textSize="25sp"
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="#+id/weighing3"
tools:text="8.5"
android:layout_marginTop="2dp"
android:layout_marginRight="8dp"
android:layout_marginEnd="8dp"/>
<EditText
android:id="#+id/weighing2"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center_vertical"
android:background="#drawable/little_square"
android:cursorVisible="false"
android:fontFamily="sans-serif-medium"
android:gravity="center"
android:hint="#string/cero_percent"
android:imeOptions="actionDone"
android:inputType="number"
android:textColor="#android:color/white"
android:textSize="25sp"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="#+id/weighing1"
tools:text="25%"
android:layout_marginLeft="8dp"
android:layout_marginTop="2dp"
android:layout_marginStart="8dp"/>
<EditText
android:id="#+id/grade2"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center_vertical"
android:background="#drawable/little_square"
android:cursorVisible="false"
android:fontFamily="sans-serif-medium"
android:gravity="center"
android:hint="#string/one"
android:imeOptions="actionDone"
android:inputType="number"
android:textColor="#android:color/white"
android:textSize="25sp"
android:visibility="gone"
app:layout_constraintLeft_toRightOf="#+id/weighing2"
app:layout_constraintRight_toLeftOf="#+id/converted2"
app:layout_constraintTop_toTopOf="#+id/weighing2"
tools:text="100" />
<TextView
android:id="#+id/converted2"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center_vertical"
android:background="#drawable/little_square"
android:fontFamily="sans-serif-medium"
android:gravity="center"
android:text="#string/one_point_cero"
android:textColor="#android:color/white"
android:textSize="25sp"
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="#+id/weighing2"
tools:text="8.5"
android:layout_marginTop="0dp"
android:layout_marginRight="8dp"
android:layout_marginEnd="8dp"/>
<EditText
android:id="#+id/weighing1"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center_vertical"
android:background="#drawable/little_square"
android:cursorVisible="false"
android:fontFamily="sans-serif-medium"
android:gravity="center"
android:hint="#string/cero_percent"
android:imeOptions="actionDone"
android:inputType="number"
android:textColor="#android:color/white"
android:textSize="25sp"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="#+id/weighing"
tools:text="25%"
android:layout_marginLeft="8dp"
android:layout_marginTop="2dp"
android:layout_marginStart="8dp"/>
<EditText
android:id="#+id/grade1"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center_vertical"
android:background="#drawable/little_square"
android:cursorVisible="false"
android:fontFamily="sans-serif-medium"
android:gravity="center"
android:hint="#string/one"
android:imeOptions="actionDone"
android:inputType="number"
android:textColor="#android:color/white"
android:textSize="25sp"
android:visibility="gone"
app:layout_constraintLeft_toRightOf="#+id/weighing1"
app:layout_constraintRight_toLeftOf="#+id/converted1"
app:layout_constraintTop_toTopOf="#+id/weighing1"
tools:text="100"
android:layout_marginTop="0dp"
app:layout_constraintHorizontal_bias="0.5" />
<TextView
android:id="#+id/converted1"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center_vertical"
android:background="#drawable/little_square"
android:fontFamily="sans-serif-medium"
android:gravity="center"
android:text="#string/one_point_cero"
android:textColor="#android:color/white"
android:textSize="25sp"
android:visibility="gone"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="#+id/weighing1"
tools:text="8.5"
android:layout_marginTop="0dp"
android:layout_marginRight="8dp"
android:layout_marginEnd="8dp"/>
<EditText
android:id="#+id/weighing"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="2dp"
android:background="#drawable/little_square"
android:cursorVisible="false"
android:fontFamily="sans-serif-medium"
android:gravity="center"
android:hint="#string/cero_percent"
android:imeOptions="actionDone"
android:inputType="number"
android:textColor="#android:color/white"
android:textSize="25sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="25%"
/>
<EditText
android:id="#+id/grade"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center_vertical"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:background="#drawable/little_square"
android:cursorVisible="false"
android:fontFamily="sans-serif-medium"
android:gravity="center"
android:hint="#string/one"
android:imeOptions="actionDone"
android:inputType="number"
android:textColor="#android:color/white"
android:textSize="25sp"
app:layout_constraintLeft_toRightOf="#+id/weighing"
app:layout_constraintRight_toLeftOf="#+id/converted"
app:layout_constraintTop_toTopOf="#+id/weighing"
tools:text="100" />
<TextView
android:id="#+id/converted"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center_vertical"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:background="#drawable/little_square"
android:fontFamily="sans-serif-medium"
android:gravity="center"
android:text="#string/one_point_cero"
android:textColor="#android:color/white"
android:textSize="25sp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="#+id/weighing"
tools:text="1.0" />
<com.google.android.gms.ads.AdView xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
ads:adSize="SMART_BANNER"
ads:adUnitId="ca-app-pub-2505831397151341/8310107897"
ads:layout_constraintBottom_toBottomOf="parent"
ads:layout_constraintHorizontal_bias="0.0"
ads:layout_constraintLeft_toLeftOf="parent"
ads:layout_constraintRight_toRightOf="parent" />
<android.support.constraint.ConstraintLayout
android:id="#+id/shareView"
android:layout_width="250dp"
android:layout_height="250dp"
android:layout_gravity="center_vertical"
android:background="#drawable/big_circle"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
app:layout_constraintBottom_toTopOf="#+id/adView"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent">
<TextSwitcher
android:id="#+id/final_grade"
android:layout_width="0dp"
android:layout_height="234dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginTop="-12dp"
android:fontFamily="sans-serif-medium"
android:gravity="center"
android:textColor="#android:color/white"
android:textSize="125sp"
tools:text="55" />
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_marginTop="-12dp"
android:fontFamily="sans-serif-medium"
android:gravity="center"
android:textColor="#android:color/white"
android:textSize="125sp"
tools:text="99" />
</TextSwitcher>
<EditText
android:id="#+id/goalGrade"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center_vertical"
android:background="#drawable/little_circle"
android:cursorVisible="false"
android:fontFamily="sans-serif-medium"
android:gravity="center"
android:inputType="number"
android:imeOptions="actionDone"
android:text="#string/five"
android:textColor="#android:color/white"
android:textSize="30sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
tools:text="#string/five"
android:layout_marginBottom="8dp" />
<TextView
android:id="#+id/first_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-medium"
android:text="#string/me_faltan"
android:textColor="#android:color/white"
android:textSize="25sp"
android:visibility="gone"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="#+id/shareView"
android:layout_marginTop="24dp"
/>
<TextView
android:id="#+id/second_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-medium"
android:text="#string/para_llegar"
android:textColor="#android:color/white"
android:textSize="20sp"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="#+id/goalGrade"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
</android.support.constraint.ConstraintLayout>
<android.support.design.widget.FloatingActionButton
android:id="#+id/floatingActionButton8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:clickable="true"
app:fabSize="mini"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="#+id/shareView"
app:srcCompat="#drawable/ic_add_white_24dp" />
<android.support.design.widget.FloatingActionButton
android:id="#+id/floatingActionButton9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:clickable="true"
app:fabSize="mini"
app:layout_constraintLeft_toLeftOf="#+id/floatingActionButton8"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/floatingActionButton8"
app:srcCompat="#drawable/ic_clear_white_24dp" />
<android.support.design.widget.FloatingActionButton
android:id="#+id/floatingActionButton10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:clickable="true"
app:fabSize="mini"
app:layout_constraintLeft_toLeftOf="#+id/floatingActionButton9"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/floatingActionButton9"
app:srcCompat="#drawable/ic_delete_sweep_white_24dp" />
<android.support.design.widget.FloatingActionButton
android:id="#+id/floatingActionButton11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:clickable="true"
app:fabSize="mini"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="#+id/floatingActionButton10"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/floatingActionButton10"
app:layout_constraintBottom_toBottomOf="#id/shareView"
app:srcCompat="#drawable/ic_play_arrow_white_24dp" />
<android.support.design.widget.FloatingActionButton
android:id="#+id/floatingActionButton12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginRight="0dp"
android:clickable="true"
app:fabSize="mini"
app:layout_constraintRight_toRightOf="#id/shareView"
app:layout_constraintBottom_toBottomOf="#+id/shareView"
app:srcCompat="#drawable/ic_share_white_24dp"
android:visibility="gone"
android:layout_marginBottom="56dp" />
</android.support.constraint.ConstraintLayout>
Check in the build.gradle(module App) for the minSdkVersion & targetSdkVersion, your device might not be in the range, if so correct that
Your display resolution might be the problem.
I tried every combination of this, some people said it's a bug but I think it's something small I'm missing. With the follwing XML, I can't scroll at all, only the horizontal scroll works.
I have a side-scroll RecyclerView which I can drag left and right, but the page has more I items than can fit, hence the ScrollView.
At first I was aiming for a collapsable toolbar, but when I add CoordinatorLayout, the activity is just blank.
My XML:
<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:nestedScrollingEnabled="true"
app:layout_constraintTop_toBottomOf="#+id/scrollv"
tools:context="com.wearecatchapp.blueandwhite.catchapp_droid.EventDetailActivity">
<android.support.v7.widget.Toolbar
android:id="#+id/detail_toolbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#fff"
android:elevation="2dp"
android:minHeight="60dp"
android:theme="#style/ThemeOverlay.AppCompat.ActionBar"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_scrollFlags="scroll|enterAlwaysCollapsed"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/evt_title"
fontPath="fonts/PanameFY.otf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textAlignment="center"
android:textColor="#color/black"
android:textSize="30sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="2dp"
android:text="Organizer's level:"
android:textAlignment="center"
android:textColor="#color/black"
android:textSize="12sp" />
<ImageView
android:id="#+id/org_level"
android:layout_width="60dp"
android:layout_height="16dp"
android:layout_gravity="center_vertical" />
</LinearLayout>
<TextView
android:id="#+id/optional_title"
fontPath="fonts/PanameFY.otf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="2dp"
android:textAlignment="center"
android:textColor="#color/black"
android:textSize="24sp"
android:visibility="gone" />
</LinearLayout>
</android.support.v7.widget.Toolbar>
<android.support.v4.widget.NestedScrollView
android:id="#+id/scrollv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="#+id/detail_toolbar">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/activity_image"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:srcCompat="#color/black" />
<TextView
android:id="#+id/month"
android:layout_width="70dp"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:text="NOV"
android:textAlignment="center"
android:textColor="#android:color/holo_red_light"
android:textSize="18sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="#+id/activity_image" />
<TextView
android:id="#+id/day"
android:layout_width="70dp"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="2dp"
android:text="15"
android:textAlignment="center"
android:textColor="#color/black"
android:textSize="24sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="#+id/month" />
<TextView
android:id="#+id/starts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:text="Starts"
android:textColor="#color/black"
android:textSize="18sp"
app:layout_constraintLeft_toRightOf="#+id/month"
app:layout_constraintTop_toBottomOf="#+id/activity_image" />
<TextView
android:id="#+id/ends"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="7dp"
android:text="Ends"
android:textColor="#color/black"
android:textSize="18sp"
app:layout_constraintLeft_toRightOf="#+id/day"
app:layout_constraintTop_toBottomOf="#+id/starts" />
<TextView
android:id="#+id/start_date"
fontPath="fonts/AvenirNext-Medium.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="42dp"
android:layout_marginStart="42dp"
android:layout_marginTop="8dp"
android:text=" 18:10 Wed, Nov 15"
android:textColor="#color/black"
android:textSize="18sp"
app:layout_constraintLeft_toRightOf="#+id/starts"
app:layout_constraintTop_toBottomOf="#+id/activity_image" />
<TextView
android:id="#+id/textView34"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginStart="50dp"
android:layout_marginTop="7dp"
android:textColor="#color/black"
android:textSize="18sp"
app:layout_constraintLeft_toRightOf="#+id/ends"
app:layout_constraintTop_toBottomOf="#+id/start_date" />
<View
android:id="#+id/view10"
id="#+id/view8"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginTop="16dp"
android:background="#color/thegray"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/linearLayout2" />
<View
android:id="#+id/view9"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginTop="9dp"
android:background="#color/thegray"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView34" />
<LinearLayout
android:id="#+id/linearLayout"
android:layout_width="397dp"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:orientation="horizontal"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView34">
<ImageView
android:id="#+id/requests_image"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_weight="1"
app:srcCompat="#drawable/requestsicon" />
<ImageView
android:id="#+id/invite_image"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_weight="1"
app:srcCompat="#drawable/invitefriends" />
<ImageView
android:id="#+id/recommend_image"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_weight="1"
app:srcCompat="#drawable/recommend" />
<ImageView
android:id="#+id/share_image"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_weight="1"
app:srcCompat="#drawable/shareblue" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="396dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/linearLayout">
<TextView
android:id="#+id/requests_text"
fontPath="fonts/avenir-next-bold.ttf"
android:layout_width="24dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Requests"
android:textAlignment="center"
android:textColor="#color/black"
android:textSize="12sp" />
<TextView
android:id="#+id/invite_friends_text"
fontPath="fonts/avenir-next-bold.ttf"
android:layout_width="24dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Invite friends"
android:textAlignment="center"
android:textColor="#color/black"
android:textSize="12sp" />
<TextView
android:id="#+id/recommend_event_text"
fontPath="fonts/avenir-next-bold.ttf"
android:layout_width="24dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Recommend"
android:textAlignment="center"
android:textColor="#color/black"
android:textSize="12sp" />
<TextView
android:id="#+id/share_text"
fontPath="fonts/avenir-next-bold.ttf"
android:layout_width="24dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Share"
android:textAlignment="center"
android:textColor="#color/black"
android:textSize="12sp" />
</LinearLayout>
<TextView
android:id="#+id/status_text"
fontPath="fonts/avenir-next-bold.ttf"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:paddingLeft="8dp"
android:textColor="#color/dark_gray"
android:textSize="20sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/view10" />
<ImageView
android:id="#+id/is_for"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="6dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="#+id/status_text"
app:srcCompat="#drawable/maleandfemale" />
<TextView
android:id="#+id/going"
fontPath="fonts/AvenirNext-Medium.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="15dp"
android:text="going"
android:textColor="#color/black"
app:layout_constraintLeft_toRightOf="#+id/is_for"
app:layout_constraintTop_toBottomOf="#+id/status_text" />
<TextView
android:id="#+id/more_togo"
fontPath="fonts/AvenirNext-Medium.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginStart="20dp"
android:layout_marginTop="15dp"
android:text="TextView"
android:textColor="#color/black"
app:layout_constraintLeft_toRightOf="#+id/hor_view"
app:layout_constraintTop_toBottomOf="#+id/status_text" />
<View
android:id="#+id/hor_view"
class="android.support.v4.widget.Space"
android:layout_width="1dp"
android:layout_height="30dp"
android:layout_marginLeft="35dp"
android:layout_marginStart="35dp"
android:layout_marginTop="8dp"
android:background="#color/dark_gray"
app:layout_constraintLeft_toRightOf="#+id/going"
app:layout_constraintTop_toBottomOf="#+id/status_text" />
<android.support.v7.widget.RecyclerView
android:id="#+id/participants_list"
android:layout_width="0dp"
android:layout_height="117dp"
android:layout_marginTop="12dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/hor_view" />
<View
android:id="#+id/view16"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginTop="8dp"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/participants_list" />
<TextView
android:id="#+id/textView47"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="17dp"
android:text="Costs"
android:textSize="18sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="#+id/view16" />
<TextView
android:id="#+id/cost_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="17dp"
android:text="TextView"
android:textSize="18sp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/view16" />
<View
android:id="#+id/view19"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginTop="55dp"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/view16" />
<TextView
android:id="#+id/cost_title_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="13dp"
android:textSize="18sp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="#+id/view19" />
<View
android:id="#+id/view20"
android:layout_width="0dp"
android:layout_height="1px"
android:layout_marginTop="16dp"
android:background="#color/thegray"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="#+id/view19" />
<ImageView
android:id="#+id/imageView15"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:padding="8dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="#+id/view20"
app:srcCompat="#drawable/pinblue" />
<TextView
android:id="#+id/textView50"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="7dp"
android:layout_marginStart="7dp"
android:layout_marginTop="16dp"
android:text="Event location"
android:textColor="#color/colorPrimary"
android:textSize="18sp"
app:layout_constraintLeft_toRightOf="#+id/imageView15"
app:layout_constraintTop_toBottomOf="#+id/view20" />
<ImageView
android:id="#+id/imageView5"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:padding="8dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView50"
app:srcCompat="#drawable/background" />
</android.support.constraint.ConstraintLayout>
</android.support.v4.widget.NestedScrollView>
<android.support.v7.widget.CardView
android:layout_width="0dp"
android:layout_height="60dp"
android:layout_marginBottom="29dp"
android:layout_marginEnd="40dp"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:layout_marginStart="40dp"
app:cardBackgroundColor="#color/colorPrimary"
app:cardCornerRadius="18dp"
app:cardElevation="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:text="REQUEST TO JOIN"
android:textColor="#android:color/white"
android:textSize="14dp" />
</android.support.v7.widget.CardView>
</android.support.constraint.ConstraintLayout>
Someone pleeeease for the love of god explain this sh*t to me.
Try adding setNestedScrollingEnabled(false) to your inner recyclerview.
https://developer.android.com/reference/android/support/v7/widget/RecyclerView.html
setNestedScrollingEnabled
Enable or disable nested scrolling for this view.
If this property is set to true the view will be permitted to initiate
nested scrolling operations with a compatible parent view in the
current hierarchy. If this view does not implement nested scrolling
this will have no effect. Disabling nested scrolling while a nested
scroll is in progress has the effect of stopping the nested scroll.
1)xml
android.support.v4.widget.NestedScrollView
inner use LinerLayout
2)
recyclerView = (RecyclerView)view.findViewById(R.id.recyclerview_main);
recyclerView.setNestedScrollingEnabled(false);
If someone still facing this issue, please take care of 2 things:
Your NestedScrollView height should be match_parent. If you are using NestedScrollView inside ConstraintLayout you can achive this by following line of code
android:layout_height="0dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
Add below line in your RecyclerView
android:nestedScrollingEnabled="false"
I hope it will save others time.