Git Product home page Git Product logo

wraplayout's Introduction

WrapLayout

ICON

项目详细地址:ProjectX(方便统一管理)

自动换行布局,水平排列子项,并自动换行,支持不等长不等宽子项,且可以设置垂直间距与水平间距及子项对齐模式。

预览

Screenshots

要求

minSdkVersion 4

引用

dependencies {
    ⋯
    compile 'am.widget:wraplayout:1.1.0'
    ⋯
}

使用

  • 基本布局
<am.widget.wraplayout.WrapLayout
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/wly_lyt_warp"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="10dp"
    android:background="@drawable/bg_wraplayout_content"
    android:horizontalSpacing="10dp"
    android:padding="10dp"
    android:verticalSpacing="10dp"
    app:wlyHorizontalSpacing="10dp"
    app:wlyVerticalSpacing="10dp">
    ⋯
</am.widget.wraplayout.WrapLayout>
  • 基本代码
WrapLayout lytWrap = (WrapLayout) findViewById(R.id.wly_lyt_warp);
lytWrap.setHorizontalSpacing(20);
lytWrap.setVerticalSpacing(20);
lytWrap.setGravity(WrapLayout.GRAVITY_CENTER);

注意

  • 继承自ViewGroup
  • android:horizontalSpacing 与 app:wlyHorizontalSpacing只定义一份即可
  • android:verticalSpacing 与 app:wlyVerticalSpacing只定义一份即可
  • 通过getNumRows()方法获取行数目
  • 通过getNumColumns(int)方法获取某一行的列数目
  • 通过setGravity(int)方法设置子项对齐模式,仅支持上中下,左右对齐是无意义的。

历史

wraplayout's People

Contributors

alexmofer avatar

Watchers

James Cloos avatar ShenHouZG 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.