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. 安装 Windows Service

    1.打开 VS 命令行窗口 2. installutil /u  service文件路径  (卸载原有服务) 3, installutil /i  service 文件路径 (安装服务)

  2. 【原创】9. MYSQL++中的Field、FieldNames以及FieldTypes类型

    mysqlpp::Field其实使用的并不多,主要在于Result.h中ResultBase以及他的派生类型(UseQueryResult和StoreQueryResult)的几个获取下一个field ...

  3. Ionic01 简单介绍、环境搭建、创建项目、项目结构、创建组件、创建页面、子页面跳转

    1 Ionic 基本介绍 Ionic 是一款基于 Angular.Cordova 的强大的 HTML5 移动应用开发框架 , 可以快速创建一个跨平台的移动应用.可以快速开发移动 App.移动端 WEB ...

  4. sqLSERVER 计划缓存

    在这一期的性能调优培训里,我想详细谈下SQL Server里计划缓存及其副作用.在上一周你已经学到,每个提交给SQL Server的逻辑查询会编译成物理执行计划.那个执行计划然后会被缓存,即被称为计划 ...

  5. Newtonsoft 序列化和反序列化特殊处理

    1>序列化,时间格式化处理 JsonConvert.SerializeObject(Iar, new JsonSerializerSettings() { DateFormatString = ...

  6. github如何上传代码

    别人写的太好了,没必要重写.备份给自己参看. 1.https://www.cnblogs.com/zlxbky/p/7727895.html 2.https://blog.csdn.net/pql92 ...

  7. zigbee--绑定

    1.绑定是zigbee一种基本通信方式:具体绑定通信又分为3种模式,在这里只拿一种源绑定来说明. 源绑定: 发送模块 :必须要知道接收模块(被绑定模块)的网络地址或者MAC地址 接收方的接收端点 接收 ...

  8. 无法解析的外部符号 _WinMain@16(原)

    原来的控制台程序,想修改为windows程序时,会出现 无法解析的外部符号 WinMain,该符号在函数 __tmainCRTStartup 中被引用 在链接器->高级->入口点输入:ma ...

  9. HttpAnalyzerStdV7安装教程

    相关链接:HttpAnalyzerStdV7使用教程 安装步骤:   1.解压压缩包   2.双击运行安装文件   3.根据向导提示点击Next   4.选择接受协议,点击Next   5.修改安装路 ...

  10. c++基础之引用reference

    1.何为引用 简单来说就是,比如你换了个新名字,用新名字叫你,你也会答应 2.引用vs指针 -引用没有null,好比你说你换了个新名字,但是新名字是啥总得有点东西 -一旦引用被初始化后就不可以指到另外 ...