android学习——SeekBar和RatingBar

SeekBar 带滑块的进度条 

xml

	


java

class SeekBarListener implements OnSeekBarChangeListener{

		@Override
		public void onProgressChanged(SeekBar seekBar, int progress,
				boolean fromUser) {
			// TODO Auto-generated method stub
			System.out.println("changed");
		}

		@Override
		public void onStartTrackingTouch(SeekBar seekBar) {
			// TODO Auto-generated method stub
			System.out.println("start");
		}

		@Override
		public void onStopTrackingTouch(SeekBar seekBar) {
			// TODO Auto-generated method stub
			System.out.println("stop");
		}
    	
    }



RatingBar 星星评价

xml

		android:layout_height="wrap_content"
		android:numStars="5"  总长
		android:id="@+id/Ratingbar" 
		android:layout_width="wrap_content"
		android:rating="2" />  默认选中


java

 class RatingBarListener implements RatingBar.OnRatingBarChangeListener{

		@Override
		public void onRatingChanged(RatingBar ratingBar, float rating,
				boolean fromUser) {
			// TODO Auto-generated method stub
			System.out.println(ratingBar.getStepSize());
		}   	
    }



你可能感兴趣的:(Android学习)