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. C# ShowDialog时窗体贱传值得方法

    用C#开发应用的时候,通常需要多个窗体!有时候为了打开窗体的时候禁止操作父窗体,我们一般采用模态对话框的方法,也算就是用ShowDialog()方法. 假设有两个窗体A和B,A作为主窗体使用ShowD ...

  2. opennebula 开发记录

    /app/opennebula/var//datastores/1/12933297f0ffeba3e55bbccabcb3153b to 127.0.0.1:/app/opennebula/data ...

  3. 修改laravel中的pagination的样式

    运行如下命令,拷贝出pagination样式到public/vendor目录下, 然后在pagination实例上调用links(‘传路径’)方法 使用起来非常方便,同时也可以自定义样式

  4. Python基础 之 变量、用户交互、if条件语句、while循环语句、编码、逻辑运算

    一.Python介绍 Python 崇尚优美.清晰.简单 Python是一门动态解释型的强制性定义的语言. 二.编译型和解释型的区别 编译型:一次性将所有与程序编译成二进制文件. 缺点:开发效率低,不 ...

  5. c# 获取非托管指针长度

    public List<string> GetPDFValues() { List<string> strs = new List<string>(); unsaf ...

  6. linq to object 未完待续

    1.linq to string string s2 = "abc"; var data2 = s2.Where(x => x.CompareTo('a') > 0). ...

  7. Part10-C语言环境初始化-C与汇编混合编程lesson4

    1.为什么要混合编程 汇编语言:执行效率高:编写繁琐: 执行效率高:能够更直接地控制处理器. c语言:可读性强,移植性好,调试方便. 1.汇编调用c函数 2.c调用汇编函数 汇编语言定义的函数(标号) ...

  8. hdu4643 GSM

    #include<stdio.h> #include<math.h> #define Max 55 #define eps 1e-8 int n,m; struct Point ...

  9. Shell内置命令

    主要Shell内置命令 Shell有很多内置在其源代码中的命令.这些命令是内置的,所以Shell不必到磁盘上搜索它们,执行速度因此加快.不同的Shell内置命令有所不同. A.2.1  bash内置命 ...

  10. web大文件上传控件-监控fd_create流程-Xproer.HttpUploader6

      监控fd_create流程 1.打开ie,f12 2.启动网络监控 点击开始捕获 上传文件夹,然后查看监控 将监控信息转到详细视图