zoukankan      html  css  js  c++  java
  • 安卓学习第22课——seekBar

    <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" 
        android:orientation="vertical">
    
        <ImageView
            android:id="@+id/image"
            android:layout_width="wrap_content"
            android:layout_height="240sp"
            android:src="@drawable/lijiang" />
        
        <SeekBar
            android:id="@+id/seekBar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="57dp" 
            android:max="255"
            android:progress="255"
            android:thumb="@drawable/ic_launcher"/>
    
    </LinearLayout>
    package com.example.seekbar;
    
    import android.app.Activity;
    import android.os.Bundle;
    import android.widget.ImageView;
    import android.widget.SeekBar;
    import android.widget.SeekBar.OnSeekBarChangeListener;
    
    public class MainActivity extends Activity {
    
        ImageView image;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            image=(ImageView) findViewById(R.id.image);
            SeekBar seekBar=(SeekBar) findViewById(R.id.seekBar);
            seekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener(){
    
                @Override
                public void onProgressChanged(SeekBar seekBar, int progress,
                        boolean fromUser) {
                    image.setImageAlpha(progress);
                }
    
                @Override
                public void onStartTrackingTouch(SeekBar seekBar) {
                }
    
                @Override
                public void onStopTrackingTouch(SeekBar seekBar) {
                }
                
            });
        }
    }
  • 相关阅读:
    timeit模块
    python中的del
    python的默认参数
    python3中的nonlocal 与 global
    python通俗讲解闭包
    vlc 视频播放器的快捷键
    Python的重要知识点汇总3
    Python的重要知识点汇总2
    Python的重要知识点汇总1
    01玩转数据结构_08_堆和优先队列
  • 原文地址:https://www.cnblogs.com/Yvettey-me/p/3935536.html
Copyright © 2011-2022 走看看