国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

安卓SlideMenu 仿QQ 主頁側(cè)滑菜單

2019-11-09 15:07:01
字體:
供稿:網(wǎng)友

先上圖 這里寫圖片描述

這里寫圖片描述

仿QQ 5.0

Activity 代碼

package custom.community.com.mydemo;import android.os.Build;import android.os.Bundle;import android.support.v7.app.AppCompatActivity;import android.view.View;import android.view.WindowManager;import com.lemonade.widgets.slidesidemenu.SlideSideMenuTransitionLayout;import custom.community.com.mydemo.utils.CircleImageView;public class MainActivity extends AppCompatActivity { PRivate SlideSideMenuTransitionLayout mSlideSideMenu; private CircleImageView head_icon; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initWindow(); // Grab the widget mSlideSideMenu = (SlideSideMenuTransitionLayout)findViewById(R.id.slide_side_menu); // Setup the toolbar head_icon = (CircleImageView) findViewById(R.id.base_toolbar); head_icon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mSlideSideMenu.toggle(); } }); } @Override public void onBackPressed() { if (mSlideSideMenu != null && mSlideSideMenu.closeSideMenu()) { // Closed the side menu, override the default back pressed behavior return; } super.onBackPressed(); } //沉浸式狀態(tài)欄 private void initWindow(){ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){ getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); } }}

xml布局

<?xml version="1.0" encoding="utf-8"?><com.lemonade.widgets.slidesidemenu.SlideSideMenuTransitionLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/slide_side_menu" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="@color/colorPrimary" android:padding="50dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="60dp" android:orientation="horizontal" android:layout_marginTop="40dp" > <custom.community.com.mydemo.utils.CircleImageView android:layout_width="40dp" android:layout_height="40dp" android:src="@drawable/head_icon" app:border_width="0dp" /><TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ffffff" android:text="小c歐巴" android:padding="12dp" /> </LinearLayout> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="20dp" android:layout_marginTop="20dp" android:textColor="#ffffff" android:text="Item 1"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="20dp" android:textSize="20dp" android:textColor="#ffffff" android:text="Item 2"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="20dp" android:textSize="20dp" android:textColor="#ffffff" android:text="Item 3"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="20dp" android:textSize="20dp" android:textColor="#ffffff" android:text="Item 4"/> </LinearLayout> <com.lemonade.widgets.slidesidemenu.SlideSideMenuContentCardView android:layout_width="match_parent" android:layout_height="match_parent"> <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ffffff"> <!-- Optional: Tool Bar --> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:background="@color/colorPrimaryDark" android:paddingTop="26dp" android:paddingLeft="12dp" android:paddingRight="12dp" android:paddingBottom="12dp" > <custom.community.com.mydemo.utils.CircleImageView android:id="@+id/base_toolbar" android:layout_width="40dp" android:layout_height="40dp" android:src="@drawable/head_icon" app:border_width="0dp" /> </android.support.design.widget.AppBarLayout> </FrameLayout> <custom.community.com.mydemo.utils.CircleImageView android:layout_width="160dp" android:layout_height="160dp" android:layout_gravity="center" android:src="@drawable/head_icon" app:border_width="2dp" /> </com.lemonade.widgets.slidesidemenu.SlideSideMenuContentCardView></com.lemonade.widgets.slidesidemenu.SlideSideMenuTransitionLayout>

可以根據(jù)自己的需求更改

build.gradle

compile 'com.android.support:appcompat-v7:25.1.0' compile 'com.android.support:design:22.2.0'

項(xiàng)目鏈接:http://download.csdn.net/detail/summer_ck/9750620


發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 瓮安县| 双桥区| 田东县| 邹平县| 东丽区| 定日县| 喀什市| 台中市| 赣州市| 台北市| 漳州市| 资讯 | 丰顺县| 易门县| 富民县| 墨竹工卡县| 景泰县| 绥芬河市| 前郭尔| 时尚| 武隆县| 吴川市| 南陵县| 喀什市| 政和县| 商洛市| 东阿县| 紫金县| 牟定县| 永州市| 保德县| 嘉祥县| 乌兰浩特市| 汽车| 吉首市| 武功县| 白河县| 商水县| 开江县| 麻阳| 景洪市|