我正在构建一个android应用程序,用户可以通过seekbar选择最大值.
I am building an android application where the user select the a maximum value by seekbar.
我需要在同一搜寻栏上另外一个按钮,以便用户可以从特定的唯一搜寻栏中选择最大值和最小值.
I need another button on the same seekbar so that user can select maximum and minimum value from a particular unique seekbar.
这是我的单搜寻条代码-
Here is my code of single seek bar -
package com.ui.yogeshblogspot; public class CustomSeekBarExActivity extends Activity implements OnSeekBarChangeListener{ /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); SeekBar bar=(SeekBar)findViewById(R.id.seekBar1); bar.setOnSeekBarChangeListener(this); } @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { // TODO Auto-generated method stub TextView tv=(TextView)findViewById(R.id.textView2); tv.setText(Integer.toString(progress)+"%"); } @Override public void onStartTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub } @Override public void onStopTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub } }这是我的搜索栏的xml代码-
Here is my xml code of seek bar -
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="schemas.android/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:background="#FFFFFF"> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Choose Your Progress" android:textColor="#000000" android:textAppearance="?android:attr/textAppearanceMedium" /> <SeekBar android:id="@+id/seekBar1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:progressDrawable="@xml/progress" android:max="100" android:thumb="@xml/thumb"/> <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#000000" android:gravity="center" android:layout_gravity="center" android:paddingTop="10dp" android:textAppearance="?android:attr/textAppearanceMedium" /> </LinearLayout> 推荐答案Android小部件类库只有一个滑块控件,seekbar只有一个拇指控件.在线进行了一些研究,发现了这个很酷的自定义小部件range-seek-bar.
The Android widget class library has only one slider control, seekbar with only one thumb control. Did some research online and found this cool custom widget, range-seek-bar.
您可以关注以下任何一项
you can followed any one of below
github/edmodo/range-bar
code.google/p/range-seek-酒吧/
github/Larpon/RangeSeekBar
更多推荐
如何在Android中制作Double seekbar?
发布评论