Android中怎么利用Activity實(shí)現(xiàn)全透明漸變切換-創(chuàng)新互聯(lián)

本篇文章給大家分享的是有關(guān)Android中怎么利用Activity實(shí)現(xiàn)全透明漸變切換,小編覺(jué)得挺實(shí)用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話不多說(shuō),跟著小編一起來(lái)看看吧。

在八步等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強(qiáng)發(fā)展的系統(tǒng)性、市場(chǎng)前瞻性、產(chǎn)品創(chuàng)新能力,以專注、極致的服務(wù)理念,為客戶提供成都做網(wǎng)站、成都網(wǎng)站建設(shè) 網(wǎng)站設(shè)計(jì)制作按需定制開(kāi)發(fā),公司網(wǎng)站建設(shè),企業(yè)網(wǎng)站建設(shè),成都品牌網(wǎng)站建設(shè),全網(wǎng)整合營(yíng)銷推廣,成都外貿(mào)網(wǎng)站制作,八步網(wǎng)站建設(shè)費(fèi)用合理。

1. 先設(shè)置Acitivity為去透明,在取消掉Activity默認(rèn)的切換動(dòng)畫(huà)

 <style name="AppTheme2" parent="Theme.AppCompat.Light">
  <!-- Customize your theme here. -->
  <item name="windowNoTitle">true</item>
  <item name="colorPrimary">@color/colorPrimary</item>
  <item name="colorPrimaryDark">@color/tabbackground</item>
  <item name="colorAccent">@color/colorAccent</item>
   <item name="android:windowBackground">@color/transparent</item>//這個(gè)之時(shí)全透明
  <item name="android:windowIsTranslucent">true</item>
  <item name="android:windowAnimationStyle">@style/activityanimation</item>
 </style>
 <style name="activityanimation" >
  <item name="android:activityOpenEnterAnimation">@null</item>
  <item name="android:activityOpenExitAnimation">@null</item>
  <item name="android:activityCloseEnterAnimation">@null</item>
  <item name="android:activityCloseExitAnimation">@null</item>
 </style>

2. 設(shè)置漸變動(dòng)畫(huà):

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:id="@+id/ll"
 android:orientation="vertical"
 android:layout_width="match_parent"
 android:background="#000"
 android:layout_height="match_parent">
 <MyImageView
  android:layout_width="match_parent"
  android:layout_height="300dp"
  android:layout_centerInParent="true"
  android:clickable="true"
  android:background="@mipmap/meinv"/>
</RelativeLayout>
public class Activitytwo extends AppCompatActivity{
 private int tran=0x00000000;
 private int end=0x88000000;
 private RelativeLayout ll;
 @Override
 protected void onCreate(@Nullable Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
  setContentView(R.layout.ativity);
  ll = (RelativeLayout) findViewById(R.id.ll);
  returnposition();
  ll.setOnClickListener(new View.OnClickListener() {
   @Override
   public void onClick(View v) {
    finish();
   }
  });
 }
 public void returnposition()
 {
  ValueAnimator colorAnim = ObjectAnimator.ofInt(ll, "backgroundColor", tran, end);
  colorAnim.setDuration(300);
  colorAnim.setEvaluator(new ArgbEvaluator());
  colorAnim.start();
 }

 @Override
 public void finish() {
  ValueAnimator colorAnim = ObjectAnimator.ofInt(ll, "backgroundColor", end, tran);
  colorAnim.setDuration(300);
  colorAnim.setEvaluator(new ArgbEvaluator());
  colorAnim.start();
  super.finish();
 }
}

以上就是Android中怎么利用Activity實(shí)現(xiàn)全透明漸變切換,小編相信有部分知識(shí)點(diǎn)可能是我們?nèi)粘9ぷ鲿?huì)見(jiàn)到或用到的。希望你能通過(guò)這篇文章學(xué)到更多知識(shí)。更多詳情敬請(qǐng)關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。

網(wǎng)站名稱:Android中怎么利用Activity實(shí)現(xiàn)全透明漸變切換-創(chuàng)新互聯(lián)
文章轉(zhuǎn)載:http://www.muchs.cn/article44/dhoiee.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)網(wǎng)站制作網(wǎng)站內(nèi)鏈網(wǎng)站營(yíng)銷、企業(yè)建站網(wǎng)站制作、微信小程序

廣告

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

網(wǎng)站建設(shè)網(wǎng)站維護(hù)公司