Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

cglw/layerlayout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

6 Commits

Repository files navigation

layerlayout

可控制布局绘制的层次的Viewgroup,基于Linearlayout,Relativelayout 通过设置view的layer 值 更改布局绘制层次

gradle dependency:

compile 'com.cg:layerlayout:0.0.1'

使用方法

以下是可控制图层的Linearlayout的使用,其他自定义的同理,layer值相同按照所在viewgroup的先后顺序绘制,不一致则按照layer大小决定绘制先后顺序,值小的先绘制,默认视图layer为0

1.xml使用

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
 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="com.cg.layerlayout.MainActivity">
 <com.cg.layerlayout.LayerLinearLayout
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:orientation="vertical">
 <View
 android:layout_width="200dp"
 android:layout_height="200dp"
 android:background="#6600ff00"
 app:layer="1"/>
 <View
 android:id="@+id/view2"
 android:layout_marginTop="-50dp"
 android:layout_width="200dp"
 android:layout_height="200dp"
 android:background="#000"
 app:layer="1"/>
 </com.cg.layerlayout.LayerLinearLayout>
</LinearLayout>

2.code中使用

 LayerLinLayoutParams layoutParams = (LayerLinLayoutParams) viewById.getLayoutParams();
 layoutParams.layer=0;

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

AltStyle によって変換されたページ (->オリジナル) /