• Android——进度条控制图片透明度


    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="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/chuanzhang"
            android:id="@+id/iv"

    /> <SeekBar android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/sbr"
           android:max="255"
    android:progress="255"

    /> </LinearLayout>

    java

    package com.example.chenshuai.test322;
    
    import android.os.Bundle;
    import android.support.v7.app.AppCompatActivity;
    import android.widget.ImageView;
    import android.widget.SeekBar;
    
    /**
     * Created by chenshuai on 2016/3/30.
     */
    public class Tutou extends AppCompatActivity {
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.touminggundonglayout);
    
            final ImageView imageView = (ImageView)findViewById(R.id.iv);
    
            final SeekBar sk_1 = (SeekBar)findViewById(R.id.sbr);
    
            sk_1.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
                @Override
                public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
    
                    imageView.setImageAlpha(progress);
                }
    
                @Override
                public void onStartTrackingTouch(SeekBar seekBar) {
    
    
                }
    
                @Override
                public void onStopTrackingTouch(SeekBar seekBar) {
    
    
                }
            });
        }
    }

  • 相关阅读:
    约瑟夫问题
    LCIS(最长公共上升子序列)
    Spfa求负环
    裴蜀(贝祖)定理
    Tarjan算法之简单缩点
    树形dp-二次扫描+换根
    sys.path.insert
    python学习之路(十二)
    python学习之路(十一)
    python学习之路(十)
  • 原文地址:https://www.cnblogs.com/Chenshuai7/p/5339527.html
Copyright © 2020-2023  润新知