ConstraintLayout for main activity buttons

This commit is contained in:
Matéo Duparc 2021-04-05 19:27:22 +02:00
parent 57d1a90ac2
commit 01f01590e2
Signed by: hardcoresushi
GPG Key ID: 007F84120107191E
2 changed files with 12 additions and 9 deletions

View File

@ -3,12 +3,12 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:orientation="vertical"
tools:context="sushi.hardcore.droidfs.MainActivity"> tools:context="sushi.hardcore.droidfs.MainActivity">
<include layout="@layout/toolbar"/> <include layout="@layout/toolbar"/>
<sushi.hardcore.droidfs.widgets.ColoredImageView <sushi.hardcore.droidfs.widgets.ColoredImageView
android:id="@+id/image_logo" android:id="@+id/image_logo"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -17,40 +17,44 @@
android:src="@drawable/logo" android:src="@drawable/logo"
android:layout_weight="1"/> android:layout_weight="1"/>
<LinearLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/aaa"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:orientation="vertical"
android:layout_weight="1"> android:layout_weight="1">
<androidx.appcompat.widget.AppCompatButton <androidx.appcompat.widget.AppCompatButton
android:id="@+id/button_open"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/main_activity_button_height" android:layout_height="@dimen/main_activity_button_height"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/button_create"
android:layout_marginHorizontal="@dimen/main_activity_button_hor_margin" android:layout_marginHorizontal="@dimen/main_activity_button_hor_margin"
android:layout_marginVertical="@dimen/main_activity_button_ver_margin"
android:onClick="onClickOpen" android:onClick="onClickOpen"
android:text="@string/open_volume" android:text="@string/open_volume"
style="@style/button"/> style="@style/button"/>
<androidx.appcompat.widget.AppCompatButton <androidx.appcompat.widget.AppCompatButton
android:id="@+id/button_create"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/main_activity_button_height" android:layout_height="@dimen/main_activity_button_height"
app:layout_constraintTop_toBottomOf="@id/button_open"
app:layout_constraintBottom_toTopOf="@id/button_change_password"
android:layout_marginHorizontal="@dimen/main_activity_button_hor_margin" android:layout_marginHorizontal="@dimen/main_activity_button_hor_margin"
android:layout_marginVertical="@dimen/main_activity_button_ver_margin"
android:onClick="onClickCreate" android:onClick="onClickCreate"
android:text="@string/create_volume" android:text="@string/create_volume"
style="@style/button"/> style="@style/button"/>
<androidx.appcompat.widget.AppCompatButton <androidx.appcompat.widget.AppCompatButton
android:id="@+id/button_change_password"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/main_activity_button_height" android:layout_height="@dimen/main_activity_button_height"
app:layout_constraintTop_toBottomOf="@id/button_create"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginHorizontal="@dimen/main_activity_button_hor_margin" android:layout_marginHorizontal="@dimen/main_activity_button_hor_margin"
android:layout_marginVertical="@dimen/main_activity_button_ver_margin"
android:onClick="onClickChangePassword" android:onClick="onClickChangePassword"
android:text="@string/change_volume_password" android:text="@string/change_volume_password"
style="@style/button"/> style="@style/button"/>
</LinearLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout> </LinearLayout>

View File

@ -2,7 +2,6 @@
<resources> <resources>
<dimen name="main_activity_button_height">60dp</dimen> <dimen name="main_activity_button_height">60dp</dimen>
<dimen name="main_activity_button_hor_margin">50dp</dimen> <dimen name="main_activity_button_hor_margin">50dp</dimen>
<dimen name="main_activity_button_ver_margin">20dp</dimen>
<dimen name="create_activity_label_width">100dp</dimen> <dimen name="create_activity_label_width">100dp</dimen>
<dimen name="edit_text_label_text_size">15sp</dimen> <dimen name="edit_text_label_text_size">15sp</dimen>
<dimen name="open_activity_label_width">90dp</dimen> <dimen name="open_activity_label_width">90dp</dimen>