We need to add these 2 lines to the ConstraintLayout element you wanted to be aligned.
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
Example
<?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.example.xxx.wtfapp.MainActivity">
<ListView
android:id="@+id/list"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ImageButton
android:id="@+id/btn_create"
android:background="@android:drawable/ic_menu_more"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:onClick="addTask"/>
</android.support.constraint.ConstraintLayout>
Reference
https://litotom.com/2016/09/21/android-studio-2-2-constraintlayout/
No comments :
Post a Comment