1.ProgressBar(进度条)

(1)介绍

(2)常用属性

(3)xml代码

<ProgressBar
android:id="@+id/progressBar2"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="48dp"
android:max="100"
android:progress="90" />

2.Seeker(拖动条)

(1)介绍

(2)属性介绍

(3)xml布局文件

    <ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:srcCompat="@mipmap/img1" /> <SeekBar
android:id="@+id/seekBar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

3.RatingBar(星级评分条)

(1)介绍

(2)属性

(3)xml布局

<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="店铺评分" /> <RatingBar
android:id="@+id/ratingBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numStars="5" /> <Button
android:id="@+id/button"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="提交" />

4.java后台

package com.lucky.test24;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RatingBar;
import android.widget.SeekBar;
import android.widget.Toast; public class MainActivity extends AppCompatActivity { ImageView imageView;
SeekBar seekBar;
ProgressBar progressBar;
EditText editText;
RatingBar ratingBar;
Button button; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
imageView=findViewById(R.id.imageView);
seekBar=findViewById(R.id.seekBar);
progressBar=findViewById(R.id.progressBar2);
editText=findViewById(R.id.editText);
ratingBar=findViewById(R.id.ratingBar);
button=findViewById(R.id.button); seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
//状态发生改变时,触发的方法
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
progressBar.setProgress(progress); //设置进度条的进度
imageView.setAlpha(progress); //设置图片的亮度
} //刚开始拖动时触发的方法
@Override
public void onStartTrackingTouch(SeekBar seekBar) { } //拖动结束后触发的方法
@Override
public void onStopTrackingTouch(SeekBar seekBar) { }
}); button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String str1="";
String str2="";
str1=str1+ratingBar.getRating(); //获取用户评分
str2="您的评价为:"+editText.getText().toString()+"\n您的评分为:"+str1;
Toast.makeText(MainActivity.this,str2,Toast.LENGTH_SHORT).show();
}
});
}
}

 5.效果图

ProgressBar(进度条)、SeekBar(拖动条)与星级评分条(RatingBar)的更多相关文章

  1. Android基础控件RatingBar星级评分条的使用

    1.简介 RatingBar继承ProgressBar,除了ProgressBar的属性外还有特有属性: android:isIndicator:是否用作指示,用户无法更改,默认false andro ...

  2. Android中点击按钮获取星级评分条的评分

    场景 效果 注: 博客: https://blog.csdn.net/badao_liumang_qizhi 关注公众号 霸道的程序猿 获取编程相关电子书.教程推送与免费下载. 实现 将布局改为Lin ...

  3. Android零基础入门第53节:拖动条SeekBar和星级评分条RatingBar

    原文:Android零基础入门第53节:拖动条SeekBar和星级评分条RatingBar 前面两期都在学习ProgressBar的使用,关于自定义ProgressBar的内容后期会继续学习的,本期先 ...

  4. 星级评分进度条(RatingBar)

    星级评分进度条(RatingBar):(主要用于评价等方面) 常用的xml属性; android:isIndicator:RatingBar是否是一个指示器(用户无法进行更改) android:num ...

  5. 二、Android应用的界面编程(六)ProgressBar及其子类[SeekBar、RatingBar]er

    通常用于向用户显示某个耗时操作完成的百分比.Android支持几种风格的进度条,通过style属性可以为ProgressBar指定风格.该属性支持如下几个属性值. # @android:style/W ...

  6. Android 自学之星级评分条RatingBar

    星级评分条(RatingBar)与拖动条十分相似,他们还有共同的父类AbsSeekBar.实际上星级评分条和拖动条的用法和功能都十分的接近:他们都允许用户通过拖动来改变进度.RatingBar与See ...

  7. Android View 之进度条+拖动条+星级评论条....

    PS:将来的你会感谢现在奋斗的自己.... 学习内容: 1.进度条 2.拖动条 3.星级评论条 1.进度条...       进图条这东西想必大家是很熟悉的...为了使用户不会觉得应用程序死掉了,因此 ...

  8. android中SeekBar拖动进度条的使用及事件监听

    下面和大家分享一下android中SeekBar拖动进度条的使用,以及事件监听.拖动进度条的事件监听需要实现SeekBar.OnSeekBarChangeListener接口,调用SeekBar的se ...

  9. Android 拖动条/滑动条控件、星级评分控件

    ProgressBar有2个子控件: SeekBar   拖动条控件 RatingBar   星级评分控件 1.拖动条控件 <SeekBar android:layout_width=" ...

随机推荐

  1. android 拍照+拍照button 以及返回按钮布局

    公司最近做一个项目拍照总是崩溃,所以决定自己写一个拍照的方法,在网上调研一番,写了一个简单demo,现共享如下 主要CameraActivity CameraActivity package com. ...

  2. Linux 多台虚拟机进行同步时间

    用SecureCRT分别连接多台虚拟机,然后使用交互窗口:

  3. 张超超OC基础回顾04_实例变量修饰(@public),点语法,self关键字,多态,继承

    零.实例变量修饰符 /* @public 就是实例变量修饰符 @public >可以在其它类中访问被public修饰的成员变量 >也可以在本类中访问被public修饰的成员变量 >可 ...

  4. 微信小程序怎么获取用户输入

    能够获取用户输入的组件,需要使用组件的属性bindchange将用户的输入内容同步到 AppService. <input id="myInput" bindchange=& ...

  5. rosbag数据记录及转换图片、视频

    博客转载自: https://blog.csdn.net/u012706484/article/details/78495896 rosbag常见的使用参数和配置 1.查看.bag中包含的信息 : r ...

  6. 第18章-使用WebSocket和STOMP实现消息功能

    Spring 4.0为WebSocket通信提供了支持,包括: 发送和接收消息的低层级API: 发送和接收消息的高级API: 用来发送消息的模板: 支持SockJS,用来解决浏览器端.服务器以及代理不 ...

  7. 【Head First Java 读书笔记】(二)类与对象

    前篇当中,代码都放在main()里面,那根本不是面向对象的做法. 椅子大战(对象如何改变你的一生) 程序规格: 在图形接口画出四方形,圆形和三角形,当用户点选图形时,图形需要顺时针转360度并依据形状 ...

  8. OO 抽象类与接口的区别

    抽象类与接口的区别 抽象类与接口的区别 一.抽象类:(抽象类适用于同一系列,并且有需要继承的成员) 概念: 1.使用abstract修饰: 2.抽象类中可以包含抽象方法: 3.抽象类只能被子类继承:( ...

  9. Stars in Your Window(线段树求最大矩形交)

    题目连接 http://poj.org/problem?id=2482 Description Fleeting time does not blur my memory of you. Can it ...

  10. 数据库抽象层 pdo

    一 . PDO的连接 $host = "localhost"; $dbname = "hejuntest"; $username = "root&qu ...