GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - hehonghui/SegmentView: This is a Android Segment Control ( View ) like iOS, support 2.3 and above.

BranchesTags
Open more actions menu

Latest commit

 

History

7 Commits
7 Commits

Folders and files

NameName
Last commit message
Last commit date
images
images
 
 
res
res
 
 
segment_demo
segment_demo
 
 
src/com/simple/widgets
src/com/simple/widgets
 
 
.gitignore
.gitignore
 
 
AndroidManifest.xml
AndroidManifest.xml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
proguard-project.txt
proguard-project.txt
 
 
project.properties
project.properties
 
 

Repository files navigation

SegmentView

This is a Android Segment Control ( View ) like iOS.

Horizontal :
gif

Vertical :
gif

效果图

gif

使用

1、 引用SegmentView工程;
2、在项目的xml中加入如下代码 :

<com.simple.widgets.SegmentView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/rg"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_gravity="top|center"
    android:layout_margin="10dp"
    android:background="@drawable/segment_shape"
    android:gravity="center"
    android:orientation="horizontal" />

3、 代码中设置tabs和回调。

SegmentView rGroup = (SegmentView) findViewById(R.id.rg);
// 默认为横向排列,如上图所示,如需纵向排列请调用setOrientation方法
// rGroup.setOrientation(SegmentView.VERTICAL);

// 设置tabs
rGroup.setTabs(new String[] {
                "主页", "朋友圈", "搜索"
        });
// 设置点击事件
rGroup.setOnItemCheckedListener(new OnItemCheckedListener() {

      @Override
      public void onCheck(RadioButton button, int position, String title) {
             Toast.makeText(getApplicationContext(),
                        "checked id = " + position + ", title = " + title,
                        Toast.LENGTH_SHORT).show();
      }
 });

License

The MIT License (MIT)

Copyright (c) 2015 Mr.Simple

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

About

This is a Android Segment Control ( View ) like iOS, support 2.3 and above.

www.devtf.cn

Resources

Readme
MIT license
Activity

Stars

39 stars

Watchers

0 watching

Forks

10 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.