This commit is contained in:
ろむねこ 2024-01-19 16:51:20 +09:00
parent 80104a2285
commit 81ba96a3d0
No known key found for this signature in database
GPG Key ID: FA1F39A1BA37D168
3 changed files with 69 additions and 38 deletions

View File

@ -7,8 +7,10 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
@ -116,6 +118,12 @@ public class HomeTopFragment extends Fragment {
// Set the Toolbar // Set the Toolbar
((AppCompatActivity)getActivity()).setSupportActionBar(toolbar); ((AppCompatActivity)getActivity()).setSupportActionBar(toolbar);
DrawerLayout drawer = view.findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
getActivity(), drawer, toolbar, one.nem.lacerta.shared.ui.R.string.placeholder, one.nem.lacerta.shared.ui.R.string.placeholder);
drawer.addDrawerListener(toggle);
toggle.syncState();
// Set the title of the CollapsingToolbarLayout // Set the title of the CollapsingToolbarLayout
collapsingToolbarLayout.setTitle("Title"); collapsingToolbarLayout.setTitle("Title");
} }

View File

@ -1,5 +1,10 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
@ -13,6 +18,7 @@
android:layout_height="128dp" android:layout_height="128dp"
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
android:minHeight="?attr/actionBarSize" android:minHeight="?attr/actionBarSize"
app:collapsedTitleGravity="start|center_vertical"
app:expandedTitleGravity="start|bottom" app:expandedTitleGravity="start|bottom"
app:expandedTitleMarginBottom="16dp" app:expandedTitleMarginBottom="16dp"
app:expandedTitleMarginStart="16dp" app:expandedTitleMarginStart="16dp"
@ -54,4 +60,13 @@
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>
<com.google.android.material.navigation.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:menu="@menu/drawer_menu" />
</androidx.drawerlayout.widget.DrawerLayout>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/item_placeholder"
android:icon="@drawable/developer_mode_24px"
android:title="@string/placeholder" />
</menu>