Skip to content

Commit

Permalink
Add new layout for small screen
Browse files Browse the repository at this point in the history
  • Loading branch information
Super12138 committed Jan 14, 2024
1 parent d04699e commit 47d1e3b
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 4 deletions.
6 changes: 4 additions & 2 deletions app/src/main/res/layout-land/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="3"
android:minHeight="160dp" />
android:minHeight="160dp"
tools:layout="@layout/fragment_progress" />

<androidx.fragment.app.FragmentContainerView
android:id="@+id/todo_frag"
android:name="cn.super12138.todo.views.todo.ToDoFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="2" />
android:layout_weight="2"
tools:layout="@layout/fragment_todo" />
</LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
50 changes: 50 additions & 0 deletions app/src/main/res/layout-small/activity_main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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:fitsSystemWindows="true"
tools:context=".views.main.MainActivity">

<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">

<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:menu="@menu/main"
app:title="@string/app_name" />
</com.google.android.material.appbar.AppBarLayout>

<androidx.core.widget.NestedScrollView
android:id="@+id/small_screen_scroll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<androidx.fragment.app.FragmentContainerView
android:id="@+id/progress_frag"
android:name="cn.super12138.todo.views.progress.ProgressFragment"
android:layout_width="match_parent"
android:layout_height="180dp"
tools:layout="@layout/fragment_progress" />

<androidx.fragment.app.FragmentContainerView
android:id="@+id/todo_frag"
android:name="cn.super12138.todo.views.todo.ToDoFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:layout="@layout/fragment_todo" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
6 changes: 4 additions & 2 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:minHeight="160dp" />
android:minHeight="160dp"
tools:layout="@layout/fragment_progress" />

<androidx.fragment.app.FragmentContainerView
android:id="@+id/todo_frag"
android:name="cn.super12138.todo.views.todo.ToDoFragment"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3" />
android:layout_weight="3"
tools:layout="@layout/fragment_todo" />
</LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

0 comments on commit 47d1e3b

Please sign in to comment.