ディレクトリ 検索
android Manifest Manifest.permission Manifest.permission_group android.accessibilityservice AccessibilityService android.accounts Account android.app NotificationManager android.bluetooth BluetoothAdapter BluetoothClass BluetoothClass.Device BluetoothClass.Device.Major BluetoothClass.Service BluetoothDevice BluetoothServerSocket BluetoothSocket android.content SharedPreferences android.database.sqlite SQLiteCursorDriver SQLiteOpenHelper android.graphics Bitmap android.location LocationListener Geocoder GpsStatus GpsStatus.Listener GpsStatus.NmeaListener GpsSatellite android.media AudioFormat AsyncPlayer AudioRecord AudioRecord.OnRecordPositionUpdateListener ThumbnailUtils AudioManager android.net TrafficStats MailTo LocalSocket android.os AsyncTask AsyncTask.Status CountDownTimer Message MessageQueue HandlerThread android.text Html android.util JsonWriter android.view ContextMenu ContextMenu.ContextMenuInfo Display ViewManager View ViewStub ViewTreeObserver ViewParent WindowManager GestureDetector Gravity MenuInflater ScaleGestureDetector SoundEffectConstants android.view.inputmethod InputConnection InputMethod InputMethodSession BaseInputConnection InputMethodManager android.widget AbsListView AbsListView.LayoutParams AbsListView.OnScrollListener AbsListView.RecyclerListener AbsoluteLayout AbsoluteLayout.LayoutParams AbsSeekBar AbsSpinner AdapterView AdapterView.AdapterContextMenuInfo AdapterView.OnItemLongClickListener AdapterView.OnItemSelectedListener AdapterView.OnItemClickListener AnalogClock BaseAdapter BaseExpandableListAdapter Button CheckBox CheckedTextView Checkable Chronometer Chronometer.OnChronometerTickListener CompoundButton CompoundButton.OnCheckedChangeListener CursorAdapter CursorTreeAdapter DatePicker DatePicker.OnDateChangedListener DialerFilter DigitalClock EditText Filter Filter.FilterListener Filter.FilterResults ExpandableListAdapter ExpandableListView.OnChildClickListener ExpandableListView.OnGroupClickListener ExpandableListView.OnGroupCollapseListener ExpandableListView.OnGroupExpandListener Filterable Gallery Gallery.LayoutParams GridView GridLayout GridLayout.Alignment RadioGroup ImageView ImageView.ScaleType HorizontalScrollView ImageButton ImageSwitcher FilterQueryProvider ListAdapter ListView MediaController MultiAutoCompleteTextView MultiAutoCompleteTextView.CommaTokenizer MultiAutoCompleteTextView.Tokenizer QuickContactBadge RadioButton RatingBar RatingBar.OnRatingBarChangeListener RelativeLayout RemoteViews ResourceCursorAdapter ResourceCursorTreeAdapter Scroller ScrollView SearchView SearchView.OnCloseListener SearchView.OnQueryTextListener SearchView.OnSuggestionListener SeekBar SeekBar.OnSeekBarChangeListener SimpleAdapter SimpleAdapter.ViewBinder SimpleCursorAdapter SimpleCursorAdapter.CursorToStringConverter SimpleCursorAdapter.ViewBinder SimpleCursorTreeAdapter SimpleCursorTreeAdapter.ViewBinder SimpleExpandableListAdapter SlidingDrawer SlidingDrawer.OnDrawerCloseListener SlidingDrawer.OnDrawerOpenListener SlidingDrawer.OnDrawerScrollListener Spinner SpinnerAdapter WrapperListAdapter TabHost TabHost.TabSpec TextView TimePicker TimePicker.OnTimeChangedListener Toast TableLayout TableLayout.LayoutParams TableRow TableRow.LayoutParams TabWidget TextSwitcher ToggleButton TwoLineListItem VideoView ViewAnimator ViewFlipper ViewSwitcher ViewSwitcher.ViewFactory ZoomButtonsController ZoomButtonsController.OnZoomListener ZoomButton ZoomControls dalvik.system DexFile
テキスト


SeekBar

译者:madgoat

博客:http://madgoat.cn/

2010-10-22

版本:Android 2.2 r1

 

public class SeekBar extends AbsSeekBar

 

java.lang.Object

         android.view.View

                android.widget.ProgressBar

                            android.widget.AbsSeekBar

                                     android.widget.SeekBar

 

概述

        

SeekBarProgressBar的扩展,在其基础上增加了一个可滑动的滑片(注:就是那个可拖动的图标)。用户可以触摸滑片并向左或向右拖动,再或者可以使用方向键都可以设置当前的进度等级。不建议把可以获取焦点的widget放在SeekBar的左边或右边。

SeekBar可以附加一个SeekBar.OnSeekBarChangeListener以获得用户操作的通知。

 

内部类

         接口        SeekBar.OnSeekBarChangeListener      

         一个回调函数用来当进度等级发生改变时通知客户端

 

XML属性

属性名称

描述

android:thumb

Seekbar上绘制的thumb(可拖动的那个图标)

 

公共方法       

         public void setOnSeekBarChangeListener (SeekBar.OnSeekBarChangeListener l)

设置一个监听器以接受seekbar进度改变时的通知。同时提供用户在SeekBar上开始和停止触摸手势时的通知。

参数

l        SeekBar的通知监听对象

参见

SeekBar.OnSeekBarChangeListener

 

补充

         文章链接

android里做一个竖着的seekbar

http://blog.csdn.net/saintswordsman/archive/2010/01/23/5248233.aspx

Android UI设计 SeekBar拖动条用法

http://www.pocketdigi.com/20100813/36.html

        

例子

Java

import android.app.Activity;

import android.os.Bundle;

import android.widget.SeekBar;

import android.widget.Toast;

import android.widget.SeekBar.OnSeekBarChangeListener;

 

public class SeekBarDemo extends Activity {

 

         @Override

         protected void onCreate(Bundle savedInstanceState) {

                   // TODO Auto-generated method stub

                   super.onCreate(savedInstanceState);

                   setContentView(R.layout.seekbardemo);

 

                   final SeekBar seekBar1 = (SeekBar) this.findViewById(R.id.seekBar1);

                   seekBar1.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

 

                            @Override

                            public void onStopTrackingTouch(SeekBar seekBar) {

                                     // TODO Auto-generated method stub

 

                            }

 

                            @Override

                            public void onStartTrackingTouch(SeekBar seekBar) {

                                     // TODO Auto-generated method stub

 

                            }

 

                            @Override

                            public void onProgressChanged(SeekBar seekBar, int progress,

                                               boolean fromUser) {

                                     // TODO Auto-generated method stub

                                     Toast.makeText(SeekBarDemo.this,

                                                        String.valueOf(seekBar1.getProgress()),

                                                        Toast.LENGTH_SHORT).show();

                            }

                   });

         }

 

}

 

XML:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

         android:layout_width="fill_parent" android:layout_height="fill_parent"

         <SeekBar android:id="@+id/seekBar1" android:layout_width="fill_parent"

                   android:layout_height="wrap_content" android:max="100"

         ></SeekBar>

</LinearLayout>

 

整理人:农民伯伯

 

 


前の記事: 次の記事: