欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

Android編程實現(xiàn)圖片透明的方法

本文實例講述了Android編程實現(xiàn)圖片透明的方法。分享給大家供大家參考,具體如下:

在岑溪等地區(qū),都構建了全面的區(qū)域性戰(zhàn)略布局,加強發(fā)展的系統(tǒng)性、市場前瞻性、產品創(chuàng)新能力,以專注、極致的服務理念,為客戶提供成都網站建設、成都網站制作 網站設計制作按需策劃設計,公司網站建設,企業(yè)網站建設,高端網站設計,全網整合營銷推廣,外貿網站制作,岑溪網站建設費用合理。

今天弄了一個圖片的透明方法。

效果圖:

Android編程實現(xiàn)圖片透明的方法

目錄結構

main.xml

<?xml version="1.0" encoding="utf-8" ?>
<LinearLayout xmlns:Android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
  <ImageView android:id="@+id/imageView" android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:layout_gravity="center_horizontal"
  android:src="@drawable/icon" />
  <Button android:id="@+id/alpha_plus"
  android:layout_width="wrap_content" android:layout_height="wrap_content"
  android:text="透明度增加" android:layout_gravity="center_horizontal"
  />
  <Button android:id="@+id/alpha_minus"
  android:layout_width="wrap_content" android:layout_height="wrap_content"
  android:text="透明度減少" android:layout_gravity="center_horizontal"
  />
</LinearLayout>

TOUMINGDUActivtiy

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
public class TOUMINGDU extends Activity {
  private ImageView imageView=null;
  private Button alpha_plus=null; //透明度增加
  private Button alpha_minus=null; //透明度減少
  private int alpha=255; //記錄ImageView的透明度
  Boolean flag=true;
  @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    imageView=(ImageView)findViewById(R.id.imageView);
    alpha_plus=(Button)findViewById(R.id.alpha_plus);
    alpha_minus=(Button)findViewById(R.id.alpha_minus);
    alpha_plus.setOnClickListener(listener);
    alpha_minus.setOnClickListener(listener);
  }
  private View.OnClickListener listener = new View.OnClickListener(){
    public void onClick(View v) {
      //加加
      if(v==alpha_plus){
        alpha+=10;
        if(alpha>255){
          alpha=255;
        }
        imageView.setAlpha(alpha);
      }
      //減減
      if(v==alpha_minus){
        alpha-=10;
        if(alpha<0){
          alpha=0;
        }
        imageView.setAlpha(alpha);
      }
    }
  };
}

OK完成....

更多關于Android相關內容感興趣的讀者可查看本站專題:《Android布局layout技巧總結》、《Android視圖View技巧總結》、《Android開發(fā)入門與進階教程》、《Android調試技巧與常見問題解決方法匯總》、《Android多媒體操作技巧匯總(音頻,視頻,錄音等)》、《Android基本組件用法總結》及《Android控件用法總結》

希望本文所述對大家Android程序設計有所幫助。

本文題目:Android編程實現(xiàn)圖片透明的方法
文章轉載:http://chinadenli.net/article42/gdopec.html

成都網站建設公司_創(chuàng)新互聯(lián),為您提供做網站網站排名、服務器托管電子商務、手機網站建設App開發(fā)

廣告

聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

h5響應式網站建設