
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:orientation="vertical"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   >
<TextView 
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"
   android:text="@string/hello"
   />
<SeekBar
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"
   android:layout_margin="10px"
   android:id="@+id/seekbar"
   android:max="100"
   android:progress="50"
   />
<TextView 
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"
   android:id="@+id/seekbarvalue"
   android:text="50"
   />
</LinearLayout>
package com.AndroidSeekBar;
import android.app.Activity;
import android.os.Bundle;
import android.widget.SeekBar;
import android.widget.TextView;
public class AndroidSeekBar extends Activity {
   /** Called when the activity is first created. */
   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.main);
      
       SeekBar seekBar = (SeekBar)findViewById(R.id.seekbar);
       final TextView seekBarValue = (TextView)findViewById(R.id.seekbarvalue);
      
       seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener(){
   @Override
   public void onProgressChanged(SeekBar seekBar, int progress,
     boolean fromUser) {
    // TODO Auto-generated method stub
    seekBarValue.setText(String.valueOf(progress));
   }
   @Override
   public void onStartTrackingTouch(SeekBar seekBar) {
    // TODO Auto-generated method stub
   }
   @Override
   public void onStopTrackingTouch(SeekBar seekBar) {
    // TODO Auto-generated method stub
   }
       });
   }
}
Thank you for reading this article SeekBar With URL http://x-tutorials.blogspot.com/2010/02/seekbar.html. Also a time to read the other articles.


0 comments:
Write your comment for this article SeekBar above!