java - Constraint layout margins keep changing -
the margins of left button keep changing can see in video , them not change.
i doing calculator , want move buttons togheter without changing margins.
the video there: https://youtu.be/ut3zinpamhy
here code:
<?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/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.a3ibm.calculator.mainactivity"> <button android:id="@+id/button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button" app:layout_constraintbaseline_tobaselineof="@+id/button2" app:layout_constraintright_toleftof="@+id/button2" android:layout_marginright="86dp" /> <button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button" app:layout_constraintleft_toleftof="parent" app:layout_constrainttop_totopof="parent" app:layout_constraintbottom_tobottomof="parent" app:layout_constraintright_torightof="parent" app:layout_constrainthorizontal_bias="0.864" app:layout_constraintvertical_bias="0.319" /> </android.support.constraint.constraintlayout>
here possible solution want. problem centering:
<?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/activity_main" android:layout_width="match_parent" android:layout_height="match_parent"> <button android:id="@+id/button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button" app:layout_constraintend_tostartof="@+id/button2" android:layout_marginend="56dp" android:layout_marginright="56dp" app:layout_constrainttop_totopof="@+id/button2" app:layout_constraintbottom_tobottomof="@+id/button2" app:layout_constraintvertical_bias="0.0" /> <button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button" tools:layout_editor_absolutey="186dp" tools:layout_editor_absolutex="208dp" /> </android.support.constraint.constraintlayout>
Comments
Post a Comment