GBSlideBar - 類似uber/滴滴等app的滑動選擇工具條

GBSlideBar 滑動選擇控件

類似uber的滑動選擇工具條

效果圖

animation

使用

<so.orion.slidebar.GBSlideBar
        android:id="@+id/gbslidebar"
        android:layout_width="wrap_content"
        android:layout_height="100dp"
        android:layout_centerInParent="true"
        app:gbs_anchor_height="25dp"
        app:gbs_anchor_width="25dp"
        app:gbs_background="#e0e0e0"
        app:gbs_paddingBottom="65dp"
        app:gbs_placeholder_width="20dp"
        app:gbs_placeholder_height="20dp"
        app:gbs_paddingLeft="10dp"
        app:gbs_paddingRight="10dp"
        app:gbs_paddingTop="25dp"
        app:gbs_textSize="14sp"
        app:gbs_textColor="#666" />
private GBSlideBar gbSlideBar;
    private SlideAdapter mAdapter;
       gbSlideBar = (GBSlideBar) findViewById(R.id.gbslidebar);

        Resources resources = getResources();
        mAdapter = new SlideAdapter(resources, new int[]{
                R.drawable.btn_tag_selector,
                R.drawable.btn_more_selector,
                R.drawable.btn_reject_selector});

        mAdapter.setTextColor(new int[]{
                Color.GREEN,
                Color.BLUE,
                Color.RED
        });

        gbSlideBar.setAdapter(mAdapter);
        gbSlideBar.setPosition(2);
        gbSlideBar.setOnGbSlideBarListener(new GBSlideBarListener() {
            @Override
            public void onPositionSelected(int position) {
                Log.d("edanelx","selected "+position);
            }
        });

引用

    allprojects {
        repositories {
            ...
            maven { url "https://jitpack.io" }
        }
    }
    dependencies {
            compile 'com.github.edanel:GBSlideBar:0.5'
    }

其他

參考:android-phased-seek-bar


項目地址: https://github.com/edanel/GBSlideBar

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!