<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.administrator.jsq.MainActivity"
android:orientation="vertical">
<!--图片透明-->
<SeekBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="250"
android:progress="0"
android:id="@+id/sar"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/f8"
android:id="@+id/tp"
/>
</LinearLayout>
 package com.example.administrator.jsq;

 import android.media.Image;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.SeekBar; public class MainActivity extends AppCompatActivity {
SeekBar sar;
ImageView tp; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
sar = (SeekBar)findViewById(R.id.sar);
tp = (ImageView)findViewById(R.id.tp);
tp.setImageAlpha(0);
sar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
tp.setImageAlpha(progress);
} @Override
public void onStartTrackingTouch(SeekBar seekBar) {
Log.e("TAG", "进度条开始拖动");
} @Override
public void onStopTrackingTouch(SeekBar seekBar) {
Log.e("TAG","进度条停止拖动");
}
});
}
}
 <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.administrator.jsq"> <application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application> </manifest>

Android 进度条改变图片透明度的更多相关文章

  1. Android课程---用进度条改变图片透明度

    <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=&quo ...

  2. Android实现拖动进度条改变图片透明度

    layout文件: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:an ...

  3. Android——进度条控制图片透明度

    xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android= ...

  4. Android中使用SeekBar拖动条实现改变图片透明度

    场景 效果 注: 博客: https://blog.csdn.net/badao_liumang_qizhi 关注公众号 霸道的程序猿 获取编程相关电子书.教程推送与免费下载. 实现 将布局改为Lin ...

  5. 多种的android进度条的特效源码

    多种的android进度条的特效源码,这个源码是在源码天堂那个网站上转载过来的,我已经修改一部分了,感觉很实用的,大家可以学习一下吧,我就不上传源码了,大家可以直接到那个网站上下载吧. 源码天堂下载地 ...

  6. android进度条

    android进度条 1.达到的效果 2.布局代码 先写一个my_browser.xml文件 存放WebView <?xml version="1.0" encoding=& ...

  7. 函数传参,改变Div任意属性的值&&图片列表:鼠标移入/移出改变图片透明度

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  8. Android 进度条(ProgressBar)和拖动条(Seekbar)补充“自定义组件”(总结)

    这周结束了,我也码了一周的字,感觉还是很有种脚踏实地的感觉的,有时间就可以看看自己的总结再查漏补缺,一步一个脚印,做出自己最理想的项目. 今天我们讲两点: 1.ProgressBar: 其实前面也稍微 ...

  9. Android 进度条

    <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=&quo ...

随机推荐

  1. Oracle11.2新特性之listagg函数 (行列转换)

    SELECT regexp_substr('公司1,贵公司2', '[^,]+', 1, LEVEL, 'i') FROM dualCONNECT BY LEVEL <= length('公司1 ...

  2. PAT乙级 1029. 旧键盘(20)

    1029. 旧键盘(20) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue 旧键盘上坏了几个键,于是在敲一段文字的 ...

  3. 让未激活的win8.1不再跳出提示激活的窗口

    以管理员运行命令行: 输入以下命令: slmgr.vbs -upk

  4. [slim] Slim - Faster, lightweight, a enginer for Ruby

    URL: http://slim-lang.com/ Example: doctype html html head title Slim Examples meta name="keywo ...

  5. (function($){...})(jQuery) 函数详解

    function(arg){...} 这是一个匿名函数,参数是arg. 而调用匿名函数时,是在函数后面写上括号和实参的,由于操作符的优先级,函数本身也需要用括号,即: function(arg){.. ...

  6. 利用VHD虚拟文件加密自己的个人信息

    1.制作VHD磁盘 计算机—管理—磁盘管理—操作—创建VHD 2.挂载卸载VHD磁盘 磁盘管理—操作—附加VHD 选择只读则不允许修改文件内容 3.用途 这样一个虚拟磁盘就被建立出来.它实际上仅仅是一 ...

  7. PHP人民币金额数字转中文大写的函数

    <?php header("Content-Type:text/html;charset=utf-8"); error_reporting(2); function cny( ...

  8. const修饰虚函数

    [1]程序1 #include <iostream> using namespace std; class Base { public: ; }; class Test : public ...

  9. Android 常用工具类之LogUtil,可以定位到代码行,双击跳转

    package cn.utils; import android.util.Log; public class LogUtils { public static boolean isDebug = t ...

  10. Pascal's Triangle II

    class Solution { public: vector<int> getRow(int rowIndex) { vector<int> v; ) return v; v ...