最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android實(shí)現(xiàn)底部半透明彈出框PopUpWindow效果

 更新時(shí)間:2017年07月11日 09:38:11   作者:qq_20801369  
這篇文章主要為大家詳細(xì)介紹了Android實(shí)現(xiàn)底部半透明彈出框PopUpWindow效果,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

Android底部半透明彈出框PopUpWindow,供大家參考,具體內(nèi)容如下

layout布局:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:background="#66fafafa"
 android:orientation="vertical">
 <LinearLayout
 android:layout_width="match_parent"
 android:layout_height="122dp"
 android:id="@+id/ll_popupwindow"
 android:background="#ffffff"
 android:layout_alignParentBottom="true"
 android:orientation="vertical"
 >
 <LinearLayout
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:layout_marginTop="26dp"
 android:orientation="horizontal">

 <TextView
  android:layout_width="0dp"
  android:layout_height="wrap_content"
  android:layout_weight="1"
  android:id="@+id/popwindow_facebook"
  android:drawableTop="@mipmap/gif_more_facebook"
  android:drawablePadding="12dp"
  android:gravity="center"
  android:text="Facebook"
  android:textColor="#4d4d4d"
  android:textSize="12sp" />

 <TextView
  android:layout_width="0dp"
  android:layout_height="wrap_content"
  android:layout_weight="1"
  android:id="@+id/popwindow_whatsapp"
  android:drawableTop="@mipmap/gif_more_whatsapp"
  android:drawablePadding="12dp"
  android:gravity="center"
  android:text="WhatsApp"
  android:visibility="gone"
  android:textColor="#4d4d4d"
  android:textSize="12sp" />

 <TextView
  android:layout_width="0dp"
  android:layout_height="wrap_content"
  android:layout_weight="1"
  android:id="@+id/popwindow_report"
  android:drawableTop="@mipmap/gif_more_report"
  android:drawablePadding="12dp"
  android:gravity="center"
  android:text="Report"
  android:textColor="#4d4d4d"
  android:textSize="12sp" />

 </LinearLayout>

 </LinearLayout>

 </RelativeLayout>

布局示意:

代碼部分:   

/*
 * 在當(dāng)前頁面調(diào)用initPopUpWindow方法,底部彈出popUpWindow
 * 重點(diǎn)在popUpWindow的layout最外層布局設(shè)置android:background="#66fafafa" 半透明
 * */
 private void initPopUpWindow(View root, final String uuid, final String title){
 Log.d("click","init popopop");
 //inflate得到布局 ,底部彈出框的View
 final View popView = LayoutInflater.from(mContext).inflate(
  R.layout.layout_bottom_popwindow, null);
 View rootView = root; // 當(dāng)前頁面的根布局
 //創(chuàng)建popUpWindow對(duì)象 寬高占滿頁面
 final PopupWindow popupWindow = new PopupWindow(popView,
  WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
 popupWindow.setTouchable(true);
 // 設(shè)置彈出動(dòng)畫
 popupWindow.setAnimationStyle(R.style.anim_edit_text_popup);
 // 顯示在根布局的底部
 popupWindow.showAtLocation(rootView, Gravity.BOTTOM | Gravity.LEFT, 0,
  0);
 //點(diǎn)擊底部彈出框之外的部分讓popUpWindow 消失
 popView.setOnTouchListener(new View.OnTouchListener() {
  @Override
  public boolean onTouch(View v, MotionEvent event) {
  int height = popView.findViewById(R.id.ll_popupwindow).getTop();
  int y=(int) event.getY();
  if(event.getAction()==MotionEvent.ACTION_UP){
   if(y<height){
   popupWindow.dismiss();
   }
  }
  return true;
  }
 });
 //彈出框中控件的點(diǎn)擊事件
 TextView share_facebook= (TextView) popView.findViewById(R.id.popwindow_facebook);
 share_facebook.setOnClickListener(new View.OnClickListener() {
  @Override
  public void onClick(View v) {
  share_facebook(uuid,title);
  popupWindow.dismiss();
  }
 });

 final TextView share_whatsApp= (TextView) popView.findViewById(R.id.popwindow_whatsapp);
 boolean whatsappFound = CheckUtils.isAppInstalled(mContext, "com.whatsapp");
 if (whatsappFound) {
  share_whatsApp.setVisibility(View.VISIBLE);
  share_whatsApp.setOnClickListener(new View.OnClickListener() {
  @Override
  public void onClick(View v) {
   share_whatsapp(uuid,title);
  }
  });
 }

 TextView report= (TextView) popView.findViewById(R.id.popwindow_report);
 report.setOnClickListener(new View.OnClickListener() {
  @Override
  public void onClick(View v) {
  Intent intent = new Intent(mContext, ReportActivity.class);

  intent.putExtra("fromch", true);

  intent.putExtra("tid", uuid);
  mContext.startActivity(intent);
  popupWindow.dismiss();<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >

 <translate
 android:duration="100"
 android:fromYDelta="0.0"
 android:toYDelta="100%" />

</set>
  } }); }

動(dòng)畫部分

進(jìn)入時(shí)從最下方彈出到最上方

消失時(shí)從最上方向下移動(dòng)直到隱藏

<style name="anim_edit_text_popup">
 <item name="android:windowEnterAnimation">@anim/popup_in</item>
 <item name="android:windowExitAnimation">@anim/popup_out</item>
</style>

popup_in:

<?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android" >

 <translate
 android:duration="100"
 android:fromYDelta="100.0%"
 android:toYDelta="0.0" />

</set>

pop_out:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >

 <translate
 android:duration="100"
 android:fromYDelta="0.0"
 android:toYDelta="100%" />

</set>

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • Android中Shape的用法詳解

    Android中Shape的用法詳解

    工作中總是會(huì)用到shape去畫一些背景,每次都要去百度,但是很多都寫的很模糊或者屬性不是很全,所以今天自己總結(jié)了一下,給大家分享一下,自己以后也可以看
    2017-07-07
  • Android Intent-Filter匹配規(guī)則解析

    Android Intent-Filter匹配規(guī)則解析

    這篇文章主要介紹了Android Intent-Filter匹配規(guī)則的相關(guān)資料,幫助大家更好的進(jìn)行Android開發(fā),感興趣的朋友可以了解下
    2020-12-12
  • Android中使用sax解析xml文件的方法

    Android中使用sax解析xml文件的方法

    本篇文章介紹了,在Android中使用sax解析xml文件的方法。需要的朋友參考下
    2013-04-04
  • Android之Gallery使用例子

    Android之Gallery使用例子

    本篇文章主要介紹了Android之Gallery使用例子,Gallery用來顯示圖片列表,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下。
    2017-01-01
  • Android開發(fā)技巧之ViewStub控件惰性裝載

    Android開發(fā)技巧之ViewStub控件惰性裝載

    布局文件中的控件并不一定在程序啟動(dòng)時(shí)全都用到,有一些控件只在特定的情況下才會(huì)被使用到;我們急需一種機(jī)制來改變<include>標(biāo)簽的這種行為,只在需要時(shí)裝載控件。這種機(jī)制就是本節(jié)要介紹的ViewStub控件
    2013-01-01
  • Android App界面的ListView布局實(shí)戰(zhàn)演練

    Android App界面的ListView布局實(shí)戰(zhàn)演練

    這篇文章主要介紹了Android App界面的ListView布局方法,文中分了三種情況通過實(shí)例來講解,ListView適用于功能最簡(jiǎn)單的應(yīng)用程序UI布局,需要的朋友可以參考下
    2016-04-04
  • APK程序獲取system權(quán)限的方法

    APK程序獲取system權(quán)限的方法

    這篇文章主要介紹了APK程序獲取system權(quán)限的方法,涉及Android程序權(quán)限操作的相關(guān)技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下
    2015-10-10
  • android JSON解析數(shù)據(jù) android解析天氣預(yù)報(bào)

    android JSON解析數(shù)據(jù) android解析天氣預(yù)報(bào)

    這篇文章主要為大家詳細(xì)介紹了android JSON解析數(shù)據(jù),android天氣預(yù)報(bào)JSON數(shù)據(jù)解析,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-03-03
  • Android實(shí)現(xiàn)代碼畫虛線邊框背景效果

    Android實(shí)現(xiàn)代碼畫虛線邊框背景效果

    可能之前遇到這樣的需求大家都會(huì)想到用圖片背景來解決,下面這篇文章將給大家介紹Android如何利用代碼畫虛線邊框背景的效果,有需要的朋友們可以參考借鑒,下面來跟著小編一起學(xué)習(xí)學(xué)習(xí)吧。
    2016-12-12
  • Android實(shí)現(xiàn)輸入法彈出時(shí)把布局頂上去和登錄按鈕頂上去的解決方法

    Android實(shí)現(xiàn)輸入法彈出時(shí)把布局頂上去和登錄按鈕頂上去的解決方法

    這篇文章主要介紹了Android實(shí)現(xiàn)輸入法彈出時(shí)把布局頂上去和登錄按鈕頂上去的解決方法,需要的朋友可以參考下
    2017-11-11

最新評(píng)論

泾源县| 龙门县| 海兴县| 乳山市| 论坛| 正宁县| 全南县| 花垣县| 大埔县| 微山县| 古田县| 宣城市| 通州市| 金川县| 沂源县| 敦化市| 九台市| 都匀市| 阳朔县| 吉林省| 丰原市| 雷州市| 北辰区| 武汉市| 武功县| 丰县| 田东县| 景宁| 宜宾市| 沿河| 玛沁县| 克什克腾旗| 抚州市| 海安县| 永嘉县| 蒙自县| 武邑县| 鸡西市| 绥中县| 彭水| 巴青县|