zoukankan      html  css  js  c++  java
  • 2.4.6 星级评分条

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/layoutMain"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        tools:context=".MainActivity" >
    
        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="match_parent"
            android:layout_height="300px"
            android:scaleType="fitCenter"
            android:src="@drawable/a1" />
    
        <RatingBar
            android:id="@+id/ratingBar1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:max="255"
            android:numStars="5"
            android:progress="255" />
    
    </LinearLayout>
    package com.moon.hello2;
    
    import java.util.Calendar;
    
    import android.R.anim;
    import android.R.integer;
    import android.app.Activity;
    import android.os.Bundle;
    import android.os.Handler;
    import android.os.Message;
    import android.view.Menu;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.widget.ArrayAdapter;
    import android.widget.AutoCompleteTextView;
    import android.widget.Button;
    import android.widget.DatePicker;
    import android.widget.ImageView;
    import android.widget.ProgressBar;
    import android.widget.RatingBar;
    import android.widget.RatingBar.OnRatingBarChangeListener;
    import android.widget.SeekBar;
    import android.widget.DatePicker.OnDateChangedListener;
    import android.widget.SeekBar.OnSeekBarChangeListener;
    import android.widget.TextView;
    import android.widget.TimePicker;
    import android.widget.TimePicker.OnTimeChangedListener;
    
    public class MainActivity extends Activity {
        private int status = 0;
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            this.setContentView(R.layout.activity_main);
            final ImageView imageView = (ImageView)findViewById(R.id.imageView1);
            RatingBar ratingBar = (RatingBar)findViewById(R.id.ratingBar1);
            ratingBar.setOnRatingBarChangeListener(new OnRatingBarChangeListener() {
                
                @Override
                public void onRatingChanged(RatingBar arg0, float rating, boolean arg2) {
                    // TODO Auto-generated method stub
                    imageView.setAlpha(rating*5/255);
                }
            });
        }
    
        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            getMenuInflater().inflate(R.menu.main, menu);
            return true;
        }
    
    }
  • 相关阅读:
    c++读写MySQL
    感叹游戏行业的飞速发展
    和真正的程序员在一起是怎样的体验
    程序媛是怎样找老公的
    IO和socket编程
    郁金香搜索引擎的方案
    实现一个自己的搜索引擎的初始规划
    JVM知识在离线数据中的运用
    看Lucene源码必须知道的基本规则和算法
    看Lucene源码必须知道的基本概念
  • 原文地址:https://www.cnblogs.com/Moon-Face/p/4506296.html
Copyright © 2011-2022 走看看