zoukankan      html  css  js  c++  java
  • andorid 进度条和图片的透明度

    layout.xml

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
    
        <ImageView
            android:layout_width="80dp"
            android:layout_height="80dp"
            android:scaleType="center"
            android:background="#f00"
            android:src="@drawable/close"
            android:id="@+id/tc1"/>
    
        <SeekBar
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:max="255"
            android:progress="255"
            android:id="@+id/kz1"
            />
    </LinearLayout>

    Layout.java

    package com.hanqi.application3;
    
    import android.app.Activity;
    import android.os.Bundle;
    import android.widget.ImageView;
    import android.widget.SeekBar;
    
    /**
     * Created by Administrator on 2016/3/31.
     */
    public class Layout extends Activity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.layout);
    
            final ImageView tc1 = (ImageView)findViewById(R.id.tc1);
            final SeekBar kz1 = (SeekBar)findViewById(R.id.kz1);
    
            kz1.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
                @Override
                public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    
                    tc1.setImageAlpha(progress);
              //如果最大值是100
              //
    tc1.setImageAlpha(progress*255/100);

    } @Override
    public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); } }
  • 相关阅读:
    Java如何实现跨平台?
    Javascript的对象再认识
    说说javacsript的函数
    setTimeout() 与setInterval()
    datepicker 插件
    table中,表头固定,body滚动的方式。也就是使用:css Table布局-display:table
    jgrid的相关知识
    学习笔记
    ES6 — 箭头函数
    受控组件
  • 原文地址:https://www.cnblogs.com/cuikang/p/5342354.html
Copyright © 2011-2022 走看看