亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

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

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

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對象 寬高占滿頁面
 final PopupWindow popupWindow = new PopupWindow(popView,
  WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
 popupWindow.setTouchable(true);
 // 設(shè)置彈出動畫
 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>
  } }); }

動畫部分

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

消失時從最上方向下移動直到隱藏

<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>

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

相關(guān)文章

  • Android 解決ScrollView嵌套CridView顯示問題

    Android 解決ScrollView嵌套CridView顯示問題

    這篇文章主要介紹了Android 解決ScrollView嵌套CridView顯示問題的相關(guān)資料,使用ScrollView嵌套CridView的時候會出現(xiàn)顯示不全的問題,這里提供解決辦法,需要的朋友可以參考下
    2017-08-08
  • Android使用Item Swipemenulistview實(shí)現(xiàn)仿QQ側(cè)滑刪除功能

    Android使用Item Swipemenulistview實(shí)現(xiàn)仿QQ側(cè)滑刪除功能

    大家都用過QQ,肯定有人好奇QQ滑動刪除Item的效果是怎樣實(shí)現(xiàn)的,其實(shí)我們使用Swipemenulistview就可以簡單的實(shí)現(xiàn)。這篇文章主要介紹了Android使用ItemSwipemenulistview實(shí)現(xiàn)仿QQ側(cè)滑刪除功能,需要的朋友可以參考下
    2017-02-02
  • 自定義Android注解系列教程之注解變量

    自定義Android注解系列教程之注解變量

    這篇文章主要給大家介紹了關(guān)于自定義Android注解系列教程之注解變量的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2018-07-07
  • Android 8.0的緩存大小和緩存清理接口方法

    Android 8.0的緩存大小和緩存清理接口方法

    今天小編就為大家分享一篇Android 8.0的緩存大小和緩存清理接口方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2018-08-08
  • Android編程實(shí)現(xiàn)對話框形式進(jìn)度條功能示例

    Android編程實(shí)現(xiàn)對話框形式進(jìn)度條功能示例

    這篇文章主要介紹了Android編程實(shí)現(xiàn)對話框形式進(jìn)度條功能,結(jié)合具體實(shí)例形式分析了Android對話框形式進(jìn)度條的功能與布局相關(guān)實(shí)現(xiàn)技巧,需要的朋友可以參考下
    2017-09-09
  • android 限制某個操作每天只能操作指定的次數(shù)(示例代碼詳解)

    android 限制某個操作每天只能操作指定的次數(shù)(示例代碼詳解)

    這篇文章主要介紹了android 限制某個操作每天只能操作指定的次數(shù),本文通過示例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2020-06-06
  • Android Studio 生成自定義jar包的步驟詳解

    Android Studio 生成自定義jar包的步驟詳解

    這篇文章主要介紹了Android Studio 生成自定義jar包的具體操作步驟,需要的朋友可以參考下
    2018-01-01
  • Flutter替換字符串中的html標(biāo)簽

    Flutter替換字符串中的html標(biāo)簽

    這篇文章主要為大家介紹了Flutter替換字符串中的html標(biāo)簽實(shí)現(xiàn)示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步早日升職加薪
    2023-05-05
  • Android編程獲取網(wǎng)絡(luò)連接方式及判斷手機(jī)卡所屬運(yùn)營商的方法

    Android編程獲取網(wǎng)絡(luò)連接方式及判斷手機(jī)卡所屬運(yùn)營商的方法

    這篇文章主要介紹了Android編程獲取網(wǎng)絡(luò)連接方式及判斷手機(jī)卡所屬運(yùn)營商的方法,涉及Android針對網(wǎng)絡(luò)的判斷及本機(jī)信息的獲取技巧,需要的朋友可以參考下
    2016-01-01
  • Android實(shí)現(xiàn)九宮格抽獎

    Android實(shí)現(xiàn)九宮格抽獎

    這篇文章主要為大家詳細(xì)介紹了Android實(shí)現(xiàn)九宮格抽獎,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2022-06-06

最新評論