Andorid Scrolling Activity(CoordinatorLayout詳情)

1.new project -> Scrolling Activity

2.Layout xml code

activity_scrolling.xml

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
 3     xmlns:app="http://schemas.android.com/apk/res-auto"
 4     xmlns:tools="http://schemas.android.com/tools"
 5     android:layout_width="match_parent"
 6     android:layout_height="match_parent"
 7     android:fitsSystemWindows="true"
 8     tools:context="com.eve.coordinatorlayoutsample.ScrollingActivity">
 9 
10     <android.support.design.widget.AppBarLayout
11         android:id="@+id/app_bar"
12         android:layout_width="match_parent"
13         android:layout_height="@dimen/app_bar_height"
14         android:fitsSystemWindows="true"
15         android:theme="@style/AppTheme.AppBarOverlay">
16 
17         <android.support.design.widget.CollapsingToolbarLayout
18             android:id="@+id/toolbar_layout"
19             android:layout_width="match_parent"
20             android:layout_height="match_parent"
21             android:fitsSystemWindows="true"
22             app:contentScrim="?attr/colorPrimary"
23             app:layout_scrollFlags="scroll|exitUntilCollapsed">
24 
25             <android.support.v7.widget.Toolbar
26                 android:id="@+id/toolbar"
27                 android:layout_width="match_parent"
28                 android:layout_height="?attr/actionBarSize"
29                 app:layout_collapseMode="pin"
30                 app:popupTheme="@style/AppTheme.PopupOverlay" />
31 
32             <ImageView
33                 android:src="@mipmap/bird"
34                 app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed"
35                 android:layout_width="match_parent"
36                 android:layout_height="match_parent"
37                 android:scaleType="centerCrop"
38                 app:layout_collapseMode="parallax"
39                 android:minHeight="?attr/actionBarSize"/>
40 
41         </android.support.design.widget.CollapsingToolbarLayout>
42     </android.support.design.widget.AppBarLayout>
43 
44     <include layout="@layout/content_scrolling" />
45 
46     <android.support.design.widget.FloatingActionButton
47         android:id="@+id/fab"
48         android:layout_width="wrap_content"
49         android:layout_height="wrap_content"
50         android:layout_margin="@dimen/fab_margin"
51         app:layout_anchor="@id/app_bar"
52         app:layout_anchorGravity="bottom|end"
53         app:srcCompat="@android:drawable/ic_dialog_email" />
54 
55 </android.support.design.widget.CoordinatorLayout>

?

content_scrolling.xml

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
 3     xmlns:app="http://schemas.android.com/apk/res-auto"
 4     xmlns:tools="http://schemas.android.com/tools"
 5     android:layout_width="match_parent"
 6     android:layout_height="match_parent"
 7     app:layout_behavior="@string/appbar_scrolling_view_behavior"
 8     tools:context="com.eve.coordinatorlayoutsample.ScrollingActivity"
 9     tools:showIn="@layout/activity_scrolling">
10 
11     <TextView
12         android:layout_width="wrap_content"
13         android:layout_height="wrap_content"
14         android:layout_margin="@dimen/text_margin"
15         android:text="@string/large_text" />
16 
17 </android.support.v4.widget.NestedScrollView>

?

3.Activity code

 1 public class ScrollingActivity extends AppCompatActivity {
 2 
 3     @Override
 4     protected void onCreate(Bundle savedInstanceState) {
 5         super.onCreate(savedInstanceState);
 6         setContentView(R.layout.activity_scrolling);
 7         Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
 8         setSupportActionBar(toolbar);
 9 
10         FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
11         fab.setOnClickListener(new View.OnClickListener() {
12             @Override
13             public void onClick(View view) {
14                 Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
15                         .setAction("Action", null).show();
16             }
17         });
18     }
19 }

?

轉載于:https://www.cnblogs.com/yiviyi/p/6846098.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/456494.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/456494.shtml
英文地址,請注明出處:http://en.pswp.cn/news/456494.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

截取utf8中文字符串

英文直接截取即可。 中文應字節長度會亂碼&#xff0c;應先轉unicode截取。 如下&#xff1a; #-*- coding:utf8 -*- s u截取中文 s.decode(utf8)[0:3].encode(utf8)轉載于:https://www.cnblogs.com/BigFishFly/p/6337183.html

解決:Navicat for mysql 設置外鍵出錯

1 看下是不是外鍵允許為空&#xff0c;不唯一等約束條件不滿足 2 或者外鍵設置刪除時為 restrict 1. 兩個字段的類型或者大小不嚴格匹配。例如&#xff0c;如果一個是int(10)&#xff0c;那么外鍵也必須設置成int(10)&#xff0c;而不是int(11)&#xff0c;也不能是tinyint。另…

Python加鹽加密方法hashlib(md5,sha224,sha1,sha256)

用random.randint隨機數給密碼加,鹽加強密碼的安全性

Ubuntu16.04以root身份登入!

首先以非root用戶身份登入系統。 1&#xff0c;修改root密碼&#xff1a;啟動shell&#xff0c;隨后在shell里面輸入命令&#xff1a; sudo passwd root 最后輸入root要使用的密碼&#xff0c;需要輸入兩次&#xff0c;這樣root密碼就修改完畢了&#xff01; 2&#xff0c;修改…

HDU2193-AVL-數據結構-AVL

題目鏈接&#xff1a;http://acm.hdu.edu.cn/statistic.php?pid2193&from126&lang&order_type0 好吧。水題一道&#xff0c;原本以為是一道寫AVL樹的想寫來練練手。沒有想到卻是這樣一道水題&#xff0c;好吧&#xff0c;猥瑣的水過。 題目意思&#xff1a; 題目大…

玩Linux碰到的問題以及使用技巧總結

文章目錄1、問題問題一&#xff1a;解壓JDK報錯&#xff1a;gzip:stdin:not in gzip format。 問題二&#xff1a;在Linux下ping不通外網 問題三&#xff1a;解決虛擬機克隆后網卡eth0不見的問題 問題四&#xff1a;執行腳本報錯&#xff1a;syntax error: unexpected end of f…

python連接MySQL數據庫搭建簡易博客

實現功能大概 將python和MySQL數據庫交互進行 封裝 ---》》utils.py 文件程序 ----》blog.py # -*- coding: utf-8 -*- # Time : 2019/08/30 15:33 # Author : Liu # File : utils.pyimport pymysql import hashlibclass dbHelper:def __init__(self, host, user, pass…

利用Sqoop在數據庫和Hive、HDFS之間做ETL操作

文章目錄[toc] 目錄&#xff1a;一、利用Sqoop&#xff0c;從Oracle到HDFS二、利用Sqoop&#xff0c;從Oracle到Hive三、遇到的問題目錄&#xff1a; 一、利用Sqoop&#xff0c;從Oracle到HDFS 第一步&#xff1a;把Oracle驅動拷貝到Sqoop安裝路徑中的lib文件夾下。 第二步&…

跨地域的VPC私網互通【高速通道案例】

最近一家大型企業正在將業務遷移至阿里云平臺&#xff0c;用戶有深圳&#xff0c;北京&#xff0c;上海等分支&#xff0c;其中上海為總部&#xff0c;用戶要求在阿里云上的華南1&#xff0c;華北2&#xff0c;華東2分別建立VPC網絡&#xff0c;其中華南1&#xff0c;華北2要與…

HDU 1711 Number Sequence(KMP模板)

http://acm.hdu.edu.cn/showproblem.php?pid1711 這道題就是一個KMP模板。 1 #include<iostream> 2 #include<cstring>3 using namespace std;4 5 const int maxn 10000005;6 7 int n,m;8 9 int next[maxn]; 10 int a[maxn], b[maxn]; 11 12 void get_next() 13…

Redis數據庫學習筆記

一、NoSql&#xff08;非關系型數據庫&#xff09; NoSQL&#xff1a;NoSQL Not Only SQL 非關系型數據庫 ? NoSQL&#xff0c;泛指非關系型的數據庫。隨著互聯網web2.0網站的興起&#xff0c;傳統的關系數據庫在應付web2.0網站&#xff0c;特別是超大規模和高并發的SNS類型…

Sqoop的安裝配置及工作機制

文章目錄[toc] 目錄&#xff1a;1、簡介2、sqoop安裝2.1、下載并解壓2.2、修改配置文件2.3、加入mysql或oracle的jdbc驅動包2.4、驗證啟動3、Sqoop的原理3.1、代碼定制目錄&#xff1a; 1、簡介 sqoop是apache旗下一款“Hadoop和關系數據庫服務器之間傳送數據”的工具。 導入…

3D打印技術在醫療領域能做些什么?幫助精確完成手術

3D打印技術出現在20世紀90年代中期。它與普通打印工作原理基本相同&#xff0c;打印機內裝有液體或粉末等“打印材料”&#xff0c;與電腦連接后&#xff0c;通過電腦控制把“打印材料”一層層疊加起來&#xff0c;最終把計算機上的藍圖變成實物。這打印技術稱為3D立體打印技術…

【一些簡單的jQuery選擇器】

學習【js DOM 編程藝術】&#xff0c;最后面有許多jQuery的選擇器&#xff0c;每個都動手敲了一遍。 jQuery 提供了高級選擇器的方法。 js獲取元素的三個基本方法分別是通過標簽名&#xff0c;類名和id&#xff0c;即(getElementsByTagName, getElementsByClassName和getElemen…

pymysql操作mysql數據庫

一、pymysql操作mysql數據庫 安裝pymysql pip install pymysql 1.1 pymysql操作數據庫的五行拳 連接數據庫 使用Connect方法連接數據庫 pymysql.Connections.Connection(hostNone, userNone, password, databaseNone, port0, charset) 參數說明&#xff1a;host – 數據庫服務…

SecureCRT常用的使用技巧

文章目錄前言&#xff1a;1、SecureCRT 超時自動斷開連接的解決辦法2、SecureCRT連接Linux時&#xff0c;終端顯示亂碼的問題。3、SecureCRT使用自動記錄日志功能4、使用SecureCRT從Windows上傳文件到Linux5、SecureCRT配色推薦和永久設置前言&#xff1a; 由于工作需要&#…

解決:(1062, Duplicate entry '2019-08-30' for key 'rdate')

解決(1062, "Duplicate entry 2019-08-30 for key rdate") 顯然這個問題是因為插入重復主鍵導致從庫不工作了&#xff0c;更改庫的唯一限制&#xff1a; unique 為normal 或者刪除unique ALTER TABLE 表明 DROP INDEX 字節名; 實例 CREATE TABLE good_booked (au…

人民幣數字金額轉大寫金額

public class t {public static String Trans2RMB(String money) {int index money.indexOf(".");if (index < 0) {// 沒有角分money money ".00";index money.indexOf(".");}if (money.substring(index, money.length()).length() < …

eventBus 與fragment

同一個eventbut是不可以注冊兩次的&#xff0c;所以我們會在ondestroy方法中進行unregister&#xff08;&#xff09; 但是在fragment中&#xff0c;最好把unregister&#xff08;&#xff09;方法寫到 onDestroyView&#xff08;&#xff09;方法中而不是onDestrory&#xff0…

機器學習之線性代數總結

目錄1、SVD是什么、表達式是什么及對應的數學含義&#xff1b;2、了解方陣、行列式的含義&#xff08;方陣即矩陣&#xff0c;行列式即矩陣的計算結果&#xff09;3、了解代數余子式的概念4、伴隨矩陣的概念5、知道方陣的逆的公式、范德蒙行列式6、知道矩陣的乘法&#xff0c;掌…