Git Product home page Git Product logo

immerselayout's Introduction

ImmerseLayout

满足普通开发者对于沉浸式界面的开发 ImmerserLinearLayout → LinearLayout ImmerserFrameLayout → FrameLayout ImmerseRelativeLayout → RelativeLayout ImmerseTableLayout → TableLayout 在需要沉浸的页面合理使用ImmerseLayout替换原本布局。

引入

  • Android Studio

在build.gradle引入 compile 'com.zhangmonke:ImmerseLayout:1.1.1'

  • eclipse

建议使用As,方便版本更新。实在不行,只有复制粘贴源码了。

如果仅仅是需要底层布局的background沉浸,则将最外层布局替换为相应的ImmerseLayout布局,其余布局不变。

enter description here

<com.monke.immerselayout.ImmerseFrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:background="@drawable/bg">
    <TextView
        android:layout_width="match_parent"
        android:layout_height="30dp"
        android:text="背景沉浸"
        android:textSize="24sp"
        android:textColor="#000000"
        android:background="#90ffffff"/

</com.monke.immerselayout.ImmerseFrameLayout>

如果对背景图片显示比例要求较高,则需要使用双重ImmerseLayout嵌套

enter description here

<com.monke.immerselayout.ImmerseFrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    app:need_immerse="true">
    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent" 
        android:src="@drawable/ivbg"
        android:scaleType="centerCrop"/>
    <com.monke.immerselayout.ImmerseLinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="布局底层ImageView沉浸,同时再次使用了一次沉浸式布局,避免内部内容也沉浸在状态栏"
            android:textSize="24sp"
            android:textColor="#000000"
            android:background="#90ffffff"/>
    </com.monke.immerselayout.ImmerseLinearLayout>
    
</com.monke.immerselayout.ImmerseFrameLayout>

如果只是要标题栏等界面沉浸

enter description here

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">
    <com.monke.immerselayout.ImmerseLinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:background="@drawable/tabcolor">
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@mipmap/ic_launcher"
            android:layout_gravity="center_horizontal"/>
    </com.monke.immerselayout.ImmerseLinearLayout>
</LinearLayout>

immerselayout's People

Contributors

zhangqinhao avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.