滑动菜单

    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:id="@+id/draw_layout"

    tools:context="com.example.dell.bigwangday_07.activity.FirstActivity">

        android:layout_width="match_parent"

        android:layout_height="match_parent">

            android:id="@+id/toobar"

            android:layout_width="match_parent"

            android:layout_height="?attr/actionBarSize"

            android:background="?attr/colorPrimary"

            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"

            app:popupTheme="@style/ThemeOverlay.AppCompat.Light">

        android:id="@+id/navigation"

        android:layout_width="match_parent"

        android:layout_height="match_parent"

        android:layout_gravity="start"

        app:menu="@menu/mymenu"

        app:headerLayout="@layout/nav_header">

    xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"

    android:layout_height="180dp"

    android:padding="10dp"

    android:background="?attr/colorPrimary">

    android:src="@mipmap/ic_launcher"

    android:layout_centerInParent="true"

    android:layout_width="wrap_content"

    android:layout_height="match_parent" />

        android:text="温文尔雅"

        android:layout_alignParentBottom="true"

        android:layout_marginLeft="150dp"

        android:textColor="#fff"

        android:layout_width="match_parent"

        android:layout_height="wrap_content" />

        android:id="@+id/shoucang"

        android:title="收藏"/>

        android:id="@+id/wode"

        android:title="我的"/>

        android:id="@+id/shezhi"

        android:title="设置"/>


private void initData() {

navigation.setCheckedItem(R.id.shoucang);

navigation.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {

@Override

        public boolean onNavigationItemSelected(@NonNull MenuItem item) {

switch (item.getItemId()) {

case R.id.shezhi:

startActivity(new Intent(FirstActivity.this,OtherActivity.class));

break;

}

return false;

}

});

}

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容