zoukankan      html  css  js  c++  java
  • RatingBar

    一、RatingBar

    Activity代码

    public class RatingBarDemoActivity extends Activity {

        private RatingBar rb=null;

        /** Called when the activity is first created. */

        @Override

        public void onCreate(Bundle savedInstanceState) {

            super.onCreate(savedInstanceState);

            setContentView(R.layout.main);

            rb=(RatingBar)findViewById(R.id.ratingbar1);

            rb.setOnRatingBarChangeListener(new ClickRatingBar());

    }

    //设置监听器

        class ClickRatingBar implements RatingBar.OnRatingBarChangeListener{

           @Override

           public void onRatingChanged(RatingBar ratingBar, float rating,

                  boolean fromUser) {

               // TODO Auto-generated method stub

               Toast.makeText(RatingBarDemoActivity.this, rating+"", Toast.LENGTH_LONG).show();

               

           }

        

        }

    }

    Main.xml代码:

    <?xmlversion="1.0"encoding="utf-8"?>

    <LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"

        android:orientation="vertical"

        android:layout_width="fill_parent"

        android:layout_height="fill_parent"

        >

    <TextView  

        android:layout_width="fill_parent" 

        android:layout_height="wrap_content" 

        android:text="@string/hello"

        />

    <RatingBar 

        android:id="@+id/ratingbar1"

        android:layout_width="wrap_content" 

        android:layout_height="wrap_content"

        android:numStars="5"

        android:stepSize="0.5"

        />

    </LinearLayout>

  • 相关阅读:
    jquery获得option的值和对option进行操作
    laravel 在添加操作自动完成对时间保存修改
    laravel使用ajax
    mysql操作查询结果case when then else end用法举例
    Laravel框架数据库CURD操作、连贯操作总结
    laravel5.1关于lists函数的bug
    详解AngularJS中的filter过滤器用法
    javascript中的时间处理
    angularJs--$on、$emit和$broadcast的使用
    angularJs--<ui-select>
  • 原文地址:https://www.cnblogs.com/itfenqing/p/4429513.html
Copyright © 2011-2022 走看看