Animation bubbles indicate the current sliding value-third-party Open Source-DiscreteSeekbar, open source WeChat third-party platform

Source: Internet
Author: User

Animation bubbles indicate the current sliding value-third-party Open Source-DiscreteSeekbar, open source third-party platform

The project home page of DiscreteSeekbar on github is: https://github.com/AnderWeb/discreteSeekBar

DiscreteSeekbar has many custom attributes and can be viewed on its github project homepage. The DiscreteSeekbar can be used like the Android native Seekbar.

Usage:

Write layout activity_main.xml:

1 <LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" 2 xmlns: tools = "http://schemas.android.com/tools" 3 xmlns: app = "http://schemas.android.com/apk/res-auto" 4 android: layout_width = "match_parent" 5 android: layout_height = "match_parent" 6 android: orientation = "vertical" 7 tools: context = "com. zzw. testdiscreteseekbar. mainActivity "> 8 9 <! -- App: maximum value of dsb_max --> 10 <! -- App: Minimum dsb_min --> 11 <! -- App: Current dsb_value value --> 12 13 <org. adw. library. widgets. discreteseekbar. discreteSeekBar14 android: id = "@ + id/discreteSeekBar1" 15 android: layout_width = "match_parent" 16 android: layout_height = "wrap_content" 17 android: layout_marginTop = "50dp" 18 app: dsb_max = "10" 19 app: dsb_min = "-10" 20 app: dsb_value = "0"/> 21 22 <! -- App: dsb_indicatorFormatter = "Value % d" indicates the displayed value, for example, 37 --> 23 <! -- App: dsb_indicatorColor = "@ android: color/holo_red_light" bubble color --> 24 <! -- App: dsb_rippleColor = "@ android: color/holo_red_light" the color of the finger position when pulling the finger --> 25 26 <org. adw. library. widgets. discreteseekbar. discreteSeekBar27 android: id = "@ + id/discreteSeekBar2" 28 android: layout_width = "match_parent" 29 android: layout_height = "wrap_content" 30 android: layout_marginTop = "50dip" 31 app: dsb_allowTrackClickToDrag = "false" 32 app: dsb_indicatorColor = "@ android: color/holo_red_light" 33 app: dsb_indicatdorf Ormatter = "Value % d" 34 app: dsb_rippleColor = "@ android: color/holo_red_light"/> 35 36 <! -- App: dsb_indicatorFormatter = "% 04d" indicates the number of digits. The number after 0 indicates the number of digits, for example, 1000, --> 37 38 <org. adw. library. widgets. discreteseekbar. discreteSeekBar39 android: id = "@ + id/discreteSeekBar3" 40 android: layout_width = "match_parent" 41 android: layout_height = "wrap_content" 42 android: layout_marginTop = "50dip" 43 app: dsb_indicatorColor = "@ android: color/holo_green_light" 44 app: dsb_indicatorFormatter = "% 04d" 45 app: dsb_max = "1000" 46 app: dsb_min = "1" 47 app: dsb_rippleColor = "@ android: color/holo_blue_light"/> 48 49 </LinearLayout>

You can set parameters for MainActivity. java:

 1 package com.zzw.testdiscreteseekbar; 2  3 import org.adw.library.widgets.discreteseekbar.DiscreteSeekBar; 4 import org.adw.library.widgets.discreteseekbar.DiscreteSeekBar.NumericTransformer; 5 import org.adw.library.widgets.discreteseekbar.DiscreteSeekBar.OnProgressChangeListener; 6  7 import android.app.Activity; 8 import android.os.Bundle; 9 import android.util.Log;10 11 public class MainActivity extends Activity {12 13     protected static final String TAG = "MainActivity";14 15     @Override16     protected void onCreate(Bundle savedInstanceState) {17         super.onCreate(savedInstanceState);18         setContentView(R.layout.activity_main);19 20         DiscreteSeekBar discreteSeekBar1 = (DiscreteSeekBar) findViewById(R.id.discreteSeekBar1);21         discreteSeekBar1.setNumericTransformer(new NumericTransformer() {22 23             @Override24             public int transform(int value) {25 26                 return value * 100;27             }28         });29 30         31         DiscreteSeekBar discreteSeekBar2 = (DiscreteSeekBar) findViewById(R.id.discreteSeekBar2);32         discreteSeekBar2.setOnProgressChangeListener(new OnProgressChangeListener() {33             34             @Override35             public void onStopTrackingTouch(DiscreteSeekBar seekBar) {36                 37             }38             39             @Override40             public void onStartTrackingTouch(DiscreteSeekBar seekBar) {41                 42             }43             44             @Override45             public void onProgressChanged(DiscreteSeekBar seekBar, int value,46                     boolean fromUser) {47                 Log.d(TAG, value+"");48             }49         });50     }51 52 }

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.