Category : constraintlayout-guideline

I have my root layout as ConstraintLayout in my activity. I have added one Guideline which is Percentage based and it is about 35 % from top. The Guideline divides the Layout in 2 section (35% top & 65% bottom). In top 25% section I have 2 TextViews. The textview text is dynamically changing. One ..

Read more

I have a view that behave correctly one phone but does not on others : <?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:orientation="vertical" android:background="@color/black" > <ImageView android:id="@+id/imageView" android:layout_width="match_parent" android:layout_height="wrap_content" app:layout_constraintTop_toTopOf="@id/logoGuideline" app:layout_constraintBottom_toBottomOf="@id/logoGuideline" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:srcCompat="@drawable/myImage"/> <TextView android:id="@+id/info1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" app:layout_constraintTop_toBottomOf="@id/infoGuideline" app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toEndOf="parent" android:textColor="@color/white" android:text="Hello World" /> <androidx.constraintlayout.widget.Guideline android:id="@+id/logoGuideline" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" app:layout_constraintGuide_percent="0.2" /> ..

Read more

I have a complex fragment layout that is crashing on specific devices. This gives the following error being thrown on applyConstraintsFromLayoutParams() method on ConstraintLayout class. java.lang.ClassCastException: androidx.constraintlayout.solver.widgets.ConstraintWidget cannot be cast to androidx.constraintlayout.solver.widgets.Guideline at androidx.constraintlayout.widget.ConstraintLayout.applyConstraintsFromLayoutParams(ConstraintLayout.java:1278) at androidx.constraintlayout.widget.ConstraintLayout.setChildrenConstraints(ConstraintLayout.java:1253) at androidx.constraintlayout.widget.ConstraintLayout.updateHierarchy(ConstraintLayout.java:1149) at androidx.constraintlayout.widget.ConstraintLayout.onMeasure(ConstraintLayout.java:1685) at android.view.View.measure(View.java:24974) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7139) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at android.view.View.measure(View.java:24974) at androidx.constraintlayout.widget.ConstraintLayout$Measurer.measure(ConstraintLayout.java:792) at androidx.constraintlayout.solver.widgets.ConstraintWidgetContainer.measure(ConstraintWidgetContainer.java:583) at androidx.constraintlayout.solver.widgets.analyzer.Direct.verticalSolvingPass(Direct.java:355) at ..

Read more

When that ad at the bottom appears, it reduces space of TextView1 but the space of green (#4CAF50) TextView2 remains the same. I want both textviews’ space to be percentally the same even after the ad showing up. I mean, guidelines should lift a bit after the banner shows up. I even tried to make ..

Read more

I’m using android constraintLayout Flow , and I have to arrange items from right to left , something like this : xml code : <androidx.constraintlayout.helper.widget.Flow android:id="@+id/flow" android:layout_width="0dp" android:layout_height="wrap_content" app:flow_horizontalStyle="spread_inside" app:flow_maxElementsWrap="4" app:flow_verticalGap="29dp" app:flow_wrapMode="aligned" app:constraint_referenced_ids="item1 , item2 , …" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toBottomOf="@id/headerTextView" /> Note : our supportsRtl set False in the Manifest … how can I do ..

Read more