目录搜索
androidManifestManifest.permissionManifest.permission_groupandroid.accessibilityserviceAccessibilityServiceandroid.accountsAccountandroid.appNotificationManagerandroid.bluetoothBluetoothAdapterBluetoothClassBluetoothClass.DeviceBluetoothClass.Device.MajorBluetoothClass.ServiceBluetoothDeviceBluetoothServerSocketBluetoothSocketandroid.contentSharedPreferencesandroid.database.sqliteSQLiteCursorDriverSQLiteOpenHelperandroid.graphicsBitmapandroid.locationLocationListenerGeocoderGpsStatusGpsStatus.ListenerGpsStatus.NmeaListenerGpsSatelliteandroid.mediaAudioFormatAsyncPlayerAudioRecordAudioRecord.OnRecordPositionUpdateListenerThumbnailUtilsAudioManagerandroid.netTrafficStatsMailToLocalSocketandroid.osAsyncTaskAsyncTask.StatusCountDownTimerMessageMessageQueueHandlerThreadandroid.textHtmlandroid.utilJsonWriterandroid.viewContextMenuContextMenu.ContextMenuInfoDisplayViewManagerViewViewStubViewTreeObserverViewParentWindowManagerGestureDetectorGravityMenuInflaterScaleGestureDetectorSoundEffectConstantsandroid.view.inputmethodInputConnectionInputMethodInputMethodSessionBaseInputConnectionInputMethodManagerandroid.widgetAbsListViewAbsListView.LayoutParamsAbsListView.OnScrollListenerAbsListView.RecyclerListenerAbsoluteLayoutAbsoluteLayout.LayoutParamsAbsSeekBarAbsSpinnerAdapterViewAdapterView.AdapterContextMenuInfoAdapterView.OnItemLongClickListenerAdapterView.OnItemSelectedListenerAdapterView.OnItemClickListenerAnalogClockBaseAdapterBaseExpandableListAdapterButtonCheckBoxCheckedTextViewCheckableChronometerChronometer.OnChronometerTickListenerCompoundButtonCompoundButton.OnCheckedChangeListenerCursorAdapterCursorTreeAdapterDatePickerDatePicker.OnDateChangedListenerDialerFilterDigitalClockEditTextFilterFilter.FilterListenerFilter.FilterResultsExpandableListAdapterExpandableListView.OnChildClickListenerExpandableListView.OnGroupClickListenerExpandableListView.OnGroupCollapseListenerExpandableListView.OnGroupExpandListenerFilterableGalleryGallery.LayoutParamsGridViewGridLayoutGridLayout.AlignmentRadioGroupImageViewImageView.ScaleTypeHorizontalScrollViewImageButtonImageSwitcherFilterQueryProviderListAdapterListViewMediaControllerMultiAutoCompleteTextViewMultiAutoCompleteTextView.CommaTokenizerMultiAutoCompleteTextView.TokenizerQuickContactBadgeRadioButtonRatingBarRatingBar.OnRatingBarChangeListenerRelativeLayoutRemoteViewsResourceCursorAdapterResourceCursorTreeAdapterScrollerScrollViewSearchViewSearchView.OnCloseListenerSearchView.OnQueryTextListenerSearchView.OnSuggestionListenerSeekBarSeekBar.OnSeekBarChangeListenerSimpleAdapterSimpleAdapter.ViewBinderSimpleCursorAdapterSimpleCursorAdapter.CursorToStringConverterSimpleCursorAdapter.ViewBinderSimpleCursorTreeAdapterSimpleCursorTreeAdapter.ViewBinderSimpleExpandableListAdapterSlidingDrawerSlidingDrawer.OnDrawerCloseListenerSlidingDrawer.OnDrawerOpenListenerSlidingDrawer.OnDrawerScrollListenerSpinnerSpinnerAdapterWrapperListAdapterTabHostTabHost.TabSpecTextViewTimePickerTimePicker.OnTimeChangedListenerToastTableLayoutTableLayout.LayoutParamsTableRowTableRow.LayoutParamsTabWidgetTextSwitcherToggleButtonTwoLineListItemVideoViewViewAnimatorViewFlipperViewSwitcherViewSwitcher.ViewFactoryZoomButtonsControllerZoomButtonsController.OnZoomListenerZoomButtonZoomControlsdalvik.systemDexFile
文字


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>

 

整理人:农民伯伯

 

 


上一篇:下一篇: