今天和大家讲解SeekBar
来源:互联网 发布:自动分析软件 编辑:程序博客网 时间:2024/06/06 01:52
main.xml
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <SeekBar android:id="@+id/seek" android:layout_width="match_parent" android:layout_height="wrap_content" android:max="100" android:progress="50" android:secondaryProgress="75" /> <TextView android:id="@+id/progress" android:layout_width="match_parent" android:layout_height="wrap_content" /> <TextView android:id="@+id/tracking" android:layout_width="match_parent" android:layout_height="wrap_content" /></LinearLayout>
package com.sun;import android.app.Activity;import android.os.Bundle;import android.widget.SeekBar;import android.widget.TextView;public class MainActivity extends Activity implements SeekBar.OnSeekBarChangeListener { SeekBar mSeekBar; TextView mProgressText; TextView mTrackingText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mSeekBar = (SeekBar)findViewById(R.id.seek); mSeekBar.setOnSeekBarChangeListener(this); mProgressText = (TextView)findViewById(R.id.progress); mTrackingText = (TextView)findViewById(R.id.tracking); } //进度条改变就会触发这个 public void onProgressChanged(SeekBar seekBar, int progress, boolean fromTouch) { mProgressText.setText(progress + " " + "from touch" + "=" + fromTouch); } //进度条点中了 public void onStartTrackingTouch(SeekBar seekBar) { mTrackingText.setText("Tracking on"); }//进度条没有焦点了 public void onStopTrackingTouch(SeekBar seekBar) { mTrackingText.setText("Tracking off"); }}
- 今天和大家讲解SeekBar
- 今天和大家讲解一下SimpleDateFormat这个类,和TextView
- 今天和大家讲解一下,标题栏显示进度条,使用setProgressBarIndeterminateVisibility()
- 今天看了一个利用MYeclipse进行Struts讲解的视频和大家分享一下
- 今天给大家讲解一下在自定义View中,如何实现画图。
- 今天第一次写,和大家打个招呼了
- 今天和大家讲一下TabHost的使用 (1)
- 和清科技今天在这里安家,欢迎大家!!
- 今天和大家聊聊Freeswitch的mod_erlang_event模块
- 今天新学习的函数,和大家分享一下
- 大家好 今天咋
- SeekBar的使用和竖向的SeekBar
- SeekBar和RatingBar
- SeekBar 和 RatingBar
- 12.8SeekBar和RatingBar
- CardView和SeekBar使用
- Snackbar 和Seekbar
- SeekBar和RatingBar
- 从C++到C——我的C语言学习笔记
- ASP.NET MVC 尝鲜
- C++_拷贝构造函数
- Java面试题
- Linux [Command]
- 今天和大家讲解SeekBar
- poj3080 kmp+枚举
- hdu 3836,tarjan算法的应用(有向图缩点)
- 练习
- 设计模式之-简单工厂模式
- code 128 字体扫描不可识别
- Android学习日记Activities
- cirrus developer key
- 使用变量的一般事项