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

Appearance settings

androidxiao/CenterFlowLayout

Open more actions menu

Repository files navigation

CenterFlowLayout

让你的子View居中显示,并且会在没有足够空间的时候,显示在下一行。

使用方法

 <com.zw.centerflowlayout.CenterFlowLayout
           android:id="@+id/id_custom_tag_group1"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           >

           <android.support.v7.widget.AppCompatCheckBox
               android:layout_width="wrap_content"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:text="再别康桥"
               />

           <android.support.v7.widget.AppCompatCheckBox
               android:layout_width="wrap_content"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:text="你曾是少年"
               />
  </com.zw.centerflowlayout.CenterFlowLayout>
  
  或者
 
       for(int i=0;i< str.length;i++) {
           TextView tv= (TextView) LayoutInflater.from(this).inflate(R.layout.custom_checked_item_view, null,false);
           tv.setText(str[i]);
           tagGroup.addView(tv);
       }
       tagGroup.setChildSpacing(dp2px(this,10));
       tagGroup.setRowSpacing(dp2px(this,20));
  

这里我使用的是android.support.v7.widget.AppCompatCheckBox,你可以替换自己想要的控件(TextView、CheckBox等等)。

属性介绍

Attribute Format Description
center_flow_layout_childSpacing                   dimension                     子View之间的间距                                                       
center_flow_layout_rowSpacing           dimension             子View的marginTop值 

ps:具体使用方法请查看Demo

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.