Open easycheese opened 6 years ago
The same issue too(
I have this issue too. To let it the scroolbar show up when using a contraint layout I'm set the following in the XML Definition of the scrollbar:
android:layout_width="wrap_content"
app:layout_constrainedWidth="true"
app:layout_constraintEnd_toEndOf="parent"
But with only this the indicator will be on the left side of the screen so I set an id to the indicator view and added a contraint for it in the linkToScrollBar
method if the parent is a contraint layout:
if( msb.getParent() instanceof ConstraintLayout) {
ConstraintLayout constraintLayout = (ConstraintLayout) msb.getParent();
ConstraintSet constraintSet = new ConstraintSet();
constraintSet.clone(constraintLayout);
constraintSet.connect(getId(), ConstraintSet.END, materialScrollBar.getId(), ConstraintSet.START,size/2);
constraintSet.applyTo(constraintLayout);
}
This is probably just a workaround, but it works for me
I even set it up with a regular RelativeLayout and converted it. Nothing works in Constraint Layout
RelativeLayout version: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.companionfree.kdmgenerator.main.MainActivity">
ConstraintLayout <?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="com.companionfree.kdmgenerator.main.MainActivity" android:id="@+id/relativeLayout">
</android.support.constraint.ConstraintLayout>