协调者布局 实现上下滑动_coordinatorlayout 上下布局-程序员宅基地

技术标签: # MaterialDialog和协调者布局  

activity_main

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:fitsSystemWindows="true"
    tools:context="com.tools.ceshi4.MainActivity">

    <Button
        android:id="@+id/bt_1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="按钮" />
    <include layout="@layout/layout_bottom"/>

</android.support.design.widget.CoordinatorLayout>

layout_bottom

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/bottom_sheet"

    android:layout_width="match_parent"

    android:layout_height="match_parent"
    android:background="@android:color/black"
    android:orientation="vertical"
    app:layout_behavior="android.support.design.widget.BottomSheetBehavior">

    <LinearLayout
        android:layout_width="match_parent"
        android:orientation="vertical"
        android:layout_height="800dp"
        android:background="@android:color/holo_red_dark">

        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="按钮" />        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="按钮" />        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="按钮" />        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="按钮" />        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="按钮" />        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="按钮" />        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="按钮" />        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="按钮" />        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="按钮" />        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="按钮" />        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="按钮" />        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="按钮" />        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="按钮" />        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="按钮" />
    </LinearLayout>


</android.support.v4.widget.NestedScrollView>
代码

package com.tools.ceshi4;

import android.os.Bundle;
import android.support.design.widget.BottomSheetBehavior;
import android.support.v4.widget.NestedScrollView;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class MainActivity extends AppCompatActivity {
    @Bind(R.id.bt_1)
    Button bt1;
    @Bind(R.id.bottom_sheet)
    NestedScrollView bottomSheet;
    private BottomSheetBehavior mBottomSheetBehavior;
    private View mBottomSheet;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);
        mBottomSheet = findViewById(R.id.bottom_sheet);
        mBottomSheetBehavior = BottomSheetBehavior.from(mBottomSheet);
        mBottomSheetBehavior.setPeekHeight(450);
        mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
    }

    private void collapsed() {
        mBottomSheetBehavior.setPeekHeight(450);
        mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
    }

    @OnClick(R.id.bt_1)
    public void onViewClicked() {
        collapsed();
    }
}



版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/mp624183768/article/details/77720629

智能推荐

python筛选因子案例_多因子量化选股模型的筛选和评价:打分法与回归法-程序员宅基地

文章浏览阅读1.2k次。多因子选股模型在模型搭建中,往往会涉及到非常多的股价影响因子,并可能导出数量极多的备选模型。因此,对于多因子选股模型的评价和筛选,就显得尤为关键。对于专业的量化投资人而言,就需要进一步了解多因子选股模型的两种主要的评价判断方法——打分法和回归法。1、打分法的评价原理和流程所谓打分法,就是根据各个因子的大小对股票进行打分,然后按照一定的权重加权得到一个总分,最后根据总分再对股票进行筛选。对于多因子模..._打分法因子选股 python

linux给文件授权_linux 授予文件-程序员宅基地

文章浏览阅读1.1w次。文件权限分为 :读,写,可执行每个文件分为三种用户:主用户,同组用户,其它系统用户用10位来表示:drwxr-xr-x第一位代表文件类型 - 代表普通文件 d 代表目录其余每三位代表一种用户的权限 授权命令 :eg: chmod u+x test表示给test文件增加可执行权限(u,g,o 分别代表三种用户 + 和 - 代表增加或者去掉权限 r_linux 授予文件

只有程序员才懂的幽默-程序员宅基地

文章浏览阅读2.1k次,点赞5次,收藏13次。点击上方“程序员大咖”,选择“置顶公众号”关键时刻,第一时间送达!以下是关于程序员的一些笑话,据说看懂的人都还在加班中。0. 老婆给当程序员的老公打电话:下班顺路买十个包子,如果看到卖西瓜的,买一个。当晚老公手捧一个包子进了家门。老婆怒道:你怎么只买一个包子?!老公甚恐,喃喃道:因为我真看到卖西瓜的了。”1. 一程序员去面试,面试官问:“你毕业才两年,这三年工作经验是怎么来的?!”程序员答:“加班_程序猿暖心告白

微机原理 基本常用操作指令_jnc微机原理-程序员宅基地

文章浏览阅读1.9w次,点赞32次,收藏212次。MOVE 目的操作数或地址 源操作数或地址 常用PUSH 压字入栈POP 从栈弹出字ADD 加法 add a,b 将a+b值存到a中INC 加一ADC 带进位的加法 add a,b 将a+b+cf存到aSUB 减法SBB 带错位减法 要考虑是否借位MUL 无符号乘法.IMUL 整数乘法.以上两条,结果回送AH和AL(字节运算),或DX和AX(字运算),DIV 无符号除法...._jnc微机原理

vagrant 安装_vagrant install-程序员宅基地

文章浏览阅读990次。手机版 繁體你好,游客 登录注册搜索 首页Linux新闻Linux教程数据库技术Linux编程服务器应用Linux安全Linux下载Linux主题Linux壁纸Linux软件数码手机电脑首页 → Linux教程背景:阅读新闻Ubuntu下安装部署Vagrant和VirtualBox详解[日期:2018-04-08]来源:cnblogs.com/suhaha 作者:霍比挫人[字体:大 中 小]一、前..._vagrant install

某眼字体反爬分析(K近邻算法解决动态字体加密)_k近邻算法与css动态字体加密-程序员宅基地

文章浏览阅读1k次。郑重声明:本项目的所有代码和相关文章,仅用于经验技术交流分享,禁止将相关技术应用到不正当途径,因为滥用技术产生的风险与本人无关。文章仅源自个人兴趣爱好,不涉及他用,侵权联系删上一次简单罗列了字体反爬的前世今生(https://mp.csdn.net/console/editor/html/105490137)本文就进行实战分析url:https://maoyan.com/boar..._k近邻算法与css动态字体加密

随便推点

toolchain安装教程支持_网上现成toolchain安装操作-程序员宅基地

文章浏览阅读1.1k次。1.ARM-ELF-TOOLSARM-ELF-TOOLS所提供的是 uClinux系统下的交叉编译工具。下载地址:到http://www.uclinux.org/pub/uClinux/arm-elf-tools/下载arm-elf-tools交叉编译工具安装程序。例如:下载之后的文件名为arm-elf-tools-20030314.sh(日期可能不同)是脚本文件。具体操作过程:(1) 首先看其权..._linux source toolchain 下载

sysbench 压测 mysql_sysbench 压测 MySQL 性能及优化-程序员宅基地

文章浏览阅读163次。sysbench 安装流程下载wget https://github.com/akopytov/sysbench/archive/master.zipunzip 安装yum install unzip解压unzip master.zip安装相关依赖yum -y install make automake libtool pkgconfig libaio-devel vim-commonyum -..._sysbench压测后mysql内存规律性高

需求分析中适应性怎么写_需求文档,怎么写才不会被打?-程序员宅基地

文章浏览阅读1k次。说起需求文档,作为产品经理的必备技能之一,恐怕没有一个产品经理不知道的吧。虽说需求文档是产品经理必备技能之一,但是要写一份开发看了不想打人的需求文档还是需要花点功夫的。什么是需求文档需求文档,就是传说中的PRD文档,全称ProductRequirement Document。需求文档的对产品的说明文档,用于完整的描述产品背景、需求和目标。需求文档的作用有很多人认为写需求文档纯属浪费时间,需求澄清时..._适应性需求

yslow chrome_YSlow / Chrome黑客-程序员宅基地

文章浏览阅读285次。yslow chromeIf you haven't seen it yet, YSlow for Chrome hit the streets couple of weeks ago. (And Google's own PageSpeed did too yesterday. (And there's now DynaTrace for Firefox. (And WebPageTest fo..._yslow chrome

5.27 C语言练习([二级C语言]计负均正:从键盘输入任意20个整型数,统计其中的负数个数并求所有正数的平均值。)_从键盘输入若干个数当读入负数时结束,计算所有正整数的平均值-程序员宅基地

文章浏览阅读3.1k次,点赞2次,收藏10次。题目要求: 从键盘输入任意20个整型数,统计其中的负数个数并求所有正数的平均值。 保留两位小数。_从键盘输入若干个数当读入负数时结束,计算所有正整数的平均值

2 个原因解答:为什么网络安全缺口大,招聘却很少?-程序员宅基地

文章浏览阅读70次。2023 年我国网络空间安全人才数量缺口超过了 140 万,就业人数却只有 10 多万,缺口高达了 93%。首先来回答第一个问题,从政策背景、市场需求、行业现状来说。

推荐文章

热门文章

相关标签