<RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="112dp" android:text="当前进度:0" /> <SeekBar android:id="@+id/seekBar1" android:thumb="@drawable/penguin" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_centerVertical="true" /> </RelativeLayout>
tv = (TextView)findViewById(R.id.textView1);
sb = (SeekBar)findViewById(R.id.seekBar1);
sb.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@Override
public void onStopTrackingTouch(SeekBar s) {
final int p = s.getProgress();
tv.setText("当前进度:" + p);
}//结束滑动
@Override
public void onStartTrackingTouch(SeekBar s) {
tv.setText("正在拖动!");
}//开始滑动
@Override
public void onProgressChanged(SeekBar s, int arg1, boolean arg2) {
}
});
<RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" > <RatingBar android:id="@+id/ratingBar1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="184dp" /> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/ratingBar1" android:layout_centerHorizontal="true" android:layout_marginBottom="100dp" android:text="评分:" /> <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/ratingBar1" android:layout_centerHorizontal="true" android:text="提交" /> </RelativeLayout>
tv = (TextView)findViewById(R.id.textView1); asb = (RatingBar)findViewById(R.id.ratingBar1); b = (Button)findViewById(R.id.button1);
b.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
final float r;
r = asb.getRating();
tv.setText("评分"+ r +"星");
}
});
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有