DrawerLayout侧滑的实现

效果图1


效果图2


代码

 protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
        frameLayout = (FrameLayout) findViewById(R.id.frame_layout);
        relativeLayout = (RelativeLayout) findViewById(R.id.rela_layout);
        listView = (ListView) findViewById(R.id.main_lv);
        radioGroup = (RadioGroup) findViewById(R.id.rg);

        List<String> list=new ArrayList<>();
        list.add("钱包");
        list.add("行程记录");
        list.add("好友邀请");
        list.add("设置");
        listView.setAdapter(new ArrayAdapter<String>(MainActivity.this,android.R.layout.simple_list_item_1,list));

        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                drawerLayout.closeDrawer(relativeLayout);
            }
        });
        getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout,new FragmentShouye()).commit();

        radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup radioGroup, @IdRes int i) {
                switch (i){
                    case R.id.rbtn1:
                        getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout,new FragmentShouye()).commit();
                        break;
                    case R.id.rbtn2:
                        getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout,new FragmentFaxian()).commit();

                        break;
                    case R.id.rbtn3:
                        getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout,new FragmentXiazai()).commit();

                        break;
                    case R.id.rbtn4:
                        getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout,new FragmentMy()).commit();

                        break;
                }
            }
        });

    }
}


xml布局

<android.support.v4.widget.DrawerLayout
    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:id="@+id/drawer_layout"
    android:layout_height="match_parent" tools:context="com.example.week3_lianxi.MainActivity">
    <!--主内容区-->
    <LinearLayout

        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        >
        <FrameLayout
            android:id="@+id/frame_layout"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="9">
        </FrameLayout>

        <RadioGroup
            android:id="@+id/rg"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:orientation="horizontal"
            android:layout_weight="1">

            <RadioButton
                android:id="@+id/rbtn1"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:button="@null"
                android:checked="true"
                android:background="@drawable/txt_rbtn"
                android:gravity="center"
                android:text="首页" />
            <RadioButton
                android:id="@+id/rbtn2"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:button="@null"
                android:background="@drawable/txt_rbtn"
                android:gravity="center"
                android:text="发现" />
            <RadioButton
                android:id="@+id/rbtn3"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:button="@null"
                android:background="@drawable/txt_rbtn"
                android:gravity="center"
                android:text="下载" />
            <RadioButton
                android:id="@+id/rbtn4"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:button="@null"
                android:background="@drawable/txt_rbtn"
                android:gravity="center"
                android:text="我的" />
        </RadioGroup>
    </LinearLayout>

<!--侧栏区-->
   <RelativeLayout
       android:id="@+id/rela_layout"
       android:layout_width="200dp"
       android:layout_height="match_parent"
       android:background="#fff"
       android:layout_gravity="left"
       >
       <ImageView
           android:id="@+id/main_img"
           android:layout_width="80dp"
           android:layout_height="80dp"
           android:layout_marginLeft="20dp"
           android:layout_marginTop="10dp"
           android:src="@mipmap/ic_launcher"/>
       <ListView
           android:id="@+id/main_lv"
           android:layout_below="@id/main_img"
           android:layout_width="match_parent"
           android:layout_height="match_parent"></ListView>

   </RelativeLayout>

</android.support.v4.widget.DrawerLayout>




内容概要:本文全面介绍了数据流图(DFD)的概念、构成元素及其重要性。数据流图是从数据传递和加工的角度,以图形方式表达系统逻辑功能、数据流向和变换过程的工具。文章详细解释了数据流图的四个基本元素:数据流、加工、数据存储和外部实体,并通过实例说明了这些元素在实际场景中的应用。文中强调了数据流图在软件开发需求分析和业务流程优化中的关键作用,通过绘制顶层、中层和底层数据流图,逐步细化系统功能,确保数据流向和处理逻辑的清晰性。此外,文章还指出了常见绘制误区及解决方法,并以在线购物系统为例进行了实战分析,展示了从需求分析到数据流图绘制的全过程。 适合人群:软件工程师、业务分析师、系统设计师以及对系统分析与设计感兴趣的初学者。 使用场景及目标:①帮助开发团队在需求分析阶段清晰展示数据流动和处理过程,避免理解偏差;②辅助企业梳理和优化业务流程,识别效率低下的环节,提升运营效率;③为系统设计和开发提供详细的逻辑框架,确保各模块的功能明确,减少开发错误。 阅读建议:本文内容详实,涵盖了从理论到实践的各个方面。建议读者在学习过程中结合实际项目背景,逐步掌握数据流图的绘制技巧,并通过反复练习和优化,加深对系统分析与设计的理解。
资源下载链接为: https://pan.quark.cn/s/5c50e6120579 《CoffeeTime_0.99.rar:主板BIOS修改工具详述》 在计算机硬件领域,BIOS(基本输入输出系统)是计算机启动时最先加载的软件,它负责初始化硬件设备,并为操作系统提供基本的交互功能。不过,随着处理器技术的持续进步,部分主板可能无法原生支持更新的CPU型号。为解决这一问题,一些技术爱好者和专业人士会通过修改主板BIOS,也就是俗称的“魔改”,来提升其兼容性。本文将深入剖析名为“CoffeeTime_0.99.rar”的工具,它是一款专门用于主板BIOS修改,以实现对第6、7、8、9代英特尔CPU支持的工具。 我们先来看“CoffeeTime.exe”,这是该工具的主程序文件。通常情况下,它会配备一套直观易用的用户界面,方便用户对BIOS进行修改操作。不过,在使用该工具之前,用户必须具备一定的电脑硬件知识,因为一旦操作失误,就可能导致系统运行不稳定,甚至无法启动。对于初学者而言,谨慎操作至关重要,否则可能会造成不可挽回的损失。 “readme.txt”是软件包中常见的文档,一般会包含使用指南、注意事项以及开发者提供的其他重要信息。在使用CoffeeTime之前,用户务必要仔细阅读该文件,因为里面可能包含了如何正确运行程序、避免错误操作以及解压后具体步骤等关键内容。 “bin”和“data”是两个文件夹,它们可能包含了用于BIOS修改的各种二进制文件和数据。“bin”文件夹通常会包含特定版本的BIOS固件或用于修改的工具,而“data”文件夹则可能包含更新CPU微码、识别信息等必要的数据文件。在进行BIOS修改的过程中,这些文件会被程序调用,从而实现对原有BIOS的扩展或修正。 BIOS的修改过程一般包含以下步骤:首先,备份原始BIOS,这是在进行任何修改前的必要步骤,以便
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值