最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android 詳解沉浸式狀態(tài)欄的實(shí)現(xiàn)流程

 更新時間:2021年11月08日 17:22:30   作者:LuckyLazyPig  
沉浸式就是要給用戶提供完全沉浸的體驗(yàn),使用戶有一種置身于虛擬世界之中的感覺。沉浸式模式就是整個屏幕中顯示都是應(yīng)用的內(nèi)容,沒有狀態(tài)欄也沒有導(dǎo)航欄,用戶不會被一些系統(tǒng)的界面元素所打擾,讓我們來實(shí)現(xiàn)下網(wǎng)上傳的沸沸揚(yáng)揚(yáng)的安卓沉浸式狀態(tài)欄

Android—沉浸式狀態(tài)欄

image

我們的征程是星辰大海,而非人間煙塵

去掉標(biāo)題欄

首先去掉對應(yīng)主題下面的Android自帶的ActionBar,只需要在對應(yīng)主題下面加NoActionBar

效果

引入依賴

implementation 'com.jaeger.statusbarutil:library:1.5.1'

沉浸狀態(tài)欄顏色

沉浸式狀態(tài)欄,既可以把顏色實(shí)現(xiàn)沉浸,又可以把圖片實(shí)現(xiàn)沉浸。

未設(shè)置顏色沉浸的狀態(tài):

image

邏輯代碼:

StatusBarUtil.setColor(MainActivity.this,getResources().getColor(R.color.teal_200),0)

image

布局文件

image

沉浸狀態(tài)欄圖片

未沉浸之前的效果

image

沉浸之后的效果

image

布局代碼

  • 將要沉浸的圖片放在ImageView組件里面
  • 其他的組件放在一個布局里面
  • 通過一個setTransparentForImageView方法替換

image

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_height="match_parent"
    tools:context=".MainActivity">

    <ImageView
        android:id="@+id/imageView"
        android:layout_width="0dp"
        android:layout_height="250dp"
        android:src="@drawable/w"
        android:layout_margin="0dp"
        android:padding="0dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/constraintLayout"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/imageView">


        <Button
            android:id="@+id/button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="115dp"
            android:text="Button"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent" />
    </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

邏輯代碼

image

StatusBarUtil.setTransparentForImageView(this,findViewById(R.id.constraintLayout));

StatusBarUtil官網(wǎng)

到此這篇關(guān)于Android 詳解沉浸式狀態(tài)欄的實(shí)現(xiàn)流程的文章就介紹到這了,更多相關(guān)Android 沉浸式狀態(tài)欄內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Android okhttp的啟動流程及源碼解析

    Android okhttp的啟動流程及源碼解析

    這篇文章主要介紹了Android okhttp的啟動流程及源碼解析,幫助大家更好的理解和學(xué)習(xí)使用Android開發(fā),感興趣的朋友可以了解下
    2021-03-03
  • Android入門之ListView應(yīng)用解析(一)

    Android入門之ListView應(yīng)用解析(一)

    這篇文章主要介紹了Android入門之ListView應(yīng)用,簡單說明了ListView的實(shí)現(xiàn),需要的朋友可以參考下
    2014-08-08
  • Android條紋進(jìn)度條的實(shí)現(xiàn)(調(diào)整view寬度仿進(jìn)度條)

    Android條紋進(jìn)度條的實(shí)現(xiàn)(調(diào)整view寬度仿進(jìn)度條)

    這篇文章主要給大家介紹了關(guān)于Android實(shí)現(xiàn)條紋進(jìn)度條的方法,主要是通過調(diào)整view寬度仿進(jìn)度條,文中通過示例代碼介紹的非常詳細(xì),對各位Android開發(fā)者們具有一定的參考學(xué)習(xí)價值,需要的朋友們下面來一起看看吧
    2018-09-09
  • 教你如何搭建android源代碼repo倉庫

    教你如何搭建android源代碼repo倉庫

    這篇文章主要介紹了如何搭建android源代碼repo倉庫,如果你的開發(fā)是基于AOSP源碼來建倉,那么搭建repo服務(wù)器和部署自己的repo倉庫就是非常必要的工作了,本文給大家詳細(xì)介紹搭建過程,感興趣的朋友一起看看吧
    2022-07-07
  • Android實(shí)現(xiàn)語音播放與錄音功能

    Android實(shí)現(xiàn)語音播放與錄音功能

    這篇文章主要為大家詳細(xì)介紹了Android實(shí)現(xiàn)語音播放與錄音功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2018-07-07
  • android+json+php+mysql實(shí)現(xiàn)用戶反饋功能方法解析

    android+json+php+mysql實(shí)現(xiàn)用戶反饋功能方法解析

    相信每個項(xiàng)目都會有用戶反饋建議等功能,這個實(shí)現(xiàn)的方法很多,下面是我實(shí)現(xiàn)的方法,供大家交流
    2012-11-11
  • android webView截圖的4種方法

    android webView截圖的4種方法

    這篇文章主要為大家詳細(xì)介紹了android webView截圖的4種方法,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2018-05-05
  • Android中WebView加載網(wǎng)頁設(shè)置進(jìn)度條

    Android中WebView加載網(wǎng)頁設(shè)置進(jìn)度條

    這篇文章主要為大家詳細(xì)介紹了Android中WebView加載網(wǎng)頁設(shè)置進(jìn)度條,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2019-05-05
  • Android開發(fā)基礎(chǔ)簡化Toast調(diào)用方法詳解

    Android開發(fā)基礎(chǔ)簡化Toast調(diào)用方法詳解

    這篇文章主要為大家介紹了Android開發(fā)基礎(chǔ)簡化Toast調(diào)用方法的相關(guān)資料,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-02-02
  • 詳解android adb常見用法

    詳解android adb常見用法

    這篇文章主要介紹了詳解android adb常見用法,對android開發(fā)測試的同學(xué)參考下
    2021-04-04

最新評論

东港市| 桑植县| 双峰县| 宁陕县| 开鲁县| 丹阳市| 望城县| 滕州市| 苍溪县| 清丰县| 绥棱县| 安徽省| 临江市| 阿尔山市| 洪江市| 顺昌县| 鹰潭市| 淮南市| 平泉县| 吐鲁番市| 伊吾县| 沅江市| 长岭县| 通江县| 谷城县| 报价| 越西县| 万年县| 邓州市| 班玛县| 新建县| 囊谦县| 伊春市| 三都| 湖北省| 宁城县| 开封市| 海淀区| 池州市| 昭觉县| 阿城市|