View disappears when padding is added in constraint layout android -
i'm trying create vertical chain of 4 circles using constraintlayout. renders until add padding constraintlayout @ point, entire view goes missing. i've been trying debug past couple of hours , tried searching in , there no question addressing problem. appreciated.
contents of layout file follows
<?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" android:id="@+id/main_input_spot_from_to_cl" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/colorprimary" android:padding="10dp" > <imageview android:id="@+id/circle1_iv" android:layout_width="10dp" android:layout_height="10dp" app:layout_constraintbottom_totopof="@+id/circle2_iv" app:layout_constraintleft_toleftof="parent" app:layout_constrainttop_totopof="parent" app:srccompat="@drawable/circle" /> <imageview android:id="@+id/circle2_iv" android:layout_width="4dp" android:layout_height="4dp" app:layout_constraintbottom_totopof="@+id/circle3_iv" app:layout_constraintleft_toleftof="@+id/circle3_iv" app:layout_constraintright_torightof="@+id/circle3_iv" app:layout_constrainttop_tobottomof="@+id/circle1_iv" app:srccompat="@drawable/circle" /> <imageview android:id="@+id/circle3_iv" android:layout_width="4dp" android:layout_height="4dp" app:layout_constraintbottom_totopof="@+id/circle4_iv" app:layout_constraintleft_toleftof="@+id/circle4_iv" app:layout_constraintright_torightof="@+id/circle4_iv" app:layout_constrainttop_tobottomof="@+id/circle2_iv" app:srccompat="@drawable/circle" /> <imageview android:id="@+id/circle4_iv" android:layout_width="10dp" android:layout_height="10dp" app:layout_constraintbottom_tobottomof="parent" app:layout_constrainttop_tobottomof="@+id/circle3_iv" app:srccompat="@drawable/circle" /> <edittext android:id="@+id/main_input_spot_from_et" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginleft="14dp" android:layout_marginstart="14dp" android:background="#00000000" android:ellipsize="end" android:hint="from station" android:inputtype="textautocomplete" android:paddingright="6dp" android:textsize="15sp" app:layout_constraintbottom_tobottomof="@+id/circle1_iv" app:layout_constraintleft_torightof="@+id/circle1_iv" app:layout_constrainttop_totopof="@+id/circle1_iv" /> </android.support.constraint.constraintlayout>
circle.xml
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="@android:color/black" /> <corners android:radius="300dp" /> </shape>
the output see is
if remove
android:padding="10dp"
from constraintlayout, it's working expected.
also, if remove left , right constraints circle 3, it's working fine. however, condensed version of have in app. tried removing left , right constraints circle3 there, it's still not working. , need padding there. if can let me know why it's behaving way here, it'll helpful in solving original problem. thanks
try, instead of defining padding in layout, define padding each view. meaning move
android:padding="10dp"
to whatever imageviews want padding on
Comments
Post a Comment