Android 通过seekBar设置图片透明度
来源:互联网 发布:java的排序函数 编辑:程序博客网 时间:2024/06/05 10:55
Java代码:
package com.example.android07_widget;import android.content.Intent;import android.os.Bundle;import android.support.annotation.Nullable;import android.support.v7.app.AppCompatActivity;import android.view.View;import android.widget.ImageView;import android.widget.SeekBar;/** * Created by Administrator on 2017/7/19 0019. */public class MainActivitythird extends AppCompatActivity { private ImageView iv_mainthird_image; private int currentAlpta=255; private SeekBar sb_mainthird_seekBar; private int n=R.drawable.s10; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_mainthird); iv_mainthird_image = (ImageView) findViewById(R.id.iv_mainthird_image); sb_mainthird_seekBar = (SeekBar) findViewById(R.id.sb_mainthird_seekBar); //设置默认清晰度 iv_mainthird_image.setImageAlpha(currentAlpta); //设置一张默认默认图片 iv_mainthird_image.setImageResource(n); //设置最大进度值 sb_mainthird_seekBar.setMax(255); //进度条停止的最大值 sb_mainthird_seekBar.setProgress(255); //通过SeekBar进度条,修改图片透明度 sb_mainthird_seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int i, boolean b) { currentAlpta=i; iv_mainthird_image.setImageAlpha(currentAlpta); } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { } }); }}
xml代码:
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <SeekBar android:id="@+id/sb_mainthird_seekBar" android:layout_width="match_parent" android:layout_height="wrap_content" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/iv_mainthird_image" /> </LinearLayout>
阅读全文
0 0
- Android 通过seekBar设置图片透明度
- android设置图片透明度
- 图片透明度。。SeekBar
- SeekBar调节图片透明度
- SeekBar改变图片透明度
- 安卓自学笔记:10:用SeekBar实现通过滑块控制图片透明度
- android 如何设置图片颜色的透明度
- Android 设置图片 Bitmap任意透明度
- Android图片淡化 透明度 设置Alpha值
- Android 设置图片 Bitmap任意透明度
- android 如何设置图片颜色的透明度
- Android 设置图片 Bitmap任意透明度
- android设置背景或者图片透明度
- Android开发——seekBar滑动条滑动改变图片的透明度
- SeekBar实例-通过SeekBar调整图片…
- CSS 设置图片透明度
- 设置图片的透明度
- 设置图片透明度
- Android Project和app中两个build.gradle配置的区别
- Debugger Engine API
- 小试牛刀(一)
- OutputStreamWriter分析
- FilterInputStream与装饰模式(2)--BufferedInputStream源码
- Android 通过seekBar设置图片透明度
- Code reviewing..............
- C++ memory ordering
- scrapy
- JAVA的String类 (转)
- Debugger Engine API
- 17_7_19:实现一个栈要求实现入栈、出栈、获得最小值的时间复杂度为O(1)
- HDU 3666 THE MATRIX PROBLEM (建图+差分约束+剪枝优化)
- s01