标签:android style blog http color io os 使用 java
1. 效果图
2. 源码文件
1. main.xml
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/LL" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <EditText android:id="@+id/editText1" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="EditText" > </EditText> <SeekBar android:id="@+id/seekBar1" android:layout_width="match_parent" android:layout_height="wrap_content" > </SeekBar> </LinearLayout>
2. firstActivity.java
package iflab.test; import android.app.Activity; import android.content.res.Resources; import android.graphics.Color; import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnFocusChangeListener; import android.view.View.OnLongClickListener; import android.view.Window; import android.widget.Button; import android.widget.DatePicker; import android.widget.DatePicker.OnDateChangedListener; import android.widget.EditText; import android.widget.ProgressBar; import android.widget.SeekBar; import android.widget.TextView; import android.widget.TimePicker; import android.widget.Toast; public class firstActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); SeekBar mSeekBar=(SeekBar)findViewById(R.id.seekBar1); //获取滑块对象 final EditText mEditText=(EditText)findViewById(R.id.editText1); //获取编辑框对象 mSeekBar.setMax(200); //设置滑块最大值 mSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { //设置监听器 @Override public void onStopTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub Toast.makeText(getApplicationContext(),"停止更改",Toast.LENGTH_LONG).show(); //显示信息 } @Override public void onStartTrackingTouch(SeekBar seekBar) { // TODO Auto-generated method stub Toast.makeText(getApplicationContext(),"开始更改",Toast.LENGTH_LONG).show(); //显示信息 } @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { // TODO Auto-generated method stub mEditText.setText("滑块的当前值为"+progress); //显示当前值 } }); } }
3. 说明
进行移动的时候会有Toast进行相应的提示 。
标签:android style blog http color io os 使用 java
原文地址:http://www.cnblogs.com/SM-t/p/3981483.html