欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Android popupWindow彈出窗體實現(xiàn)方法分析

 更新時間:2017年07月13日 11:06:39   作者:只要你能好  
這篇文章主要介紹了Android popupWindow彈出窗體實現(xiàn)方法,結(jié)合具體實例形式分析了Android彈出窗體的布局及popupwindow屬性設置、事件監(jiān)聽相關操作技巧,需要的朋友可以參考下

本文實例講述了Android popupWindow彈出窗體實現(xiàn)方法。分享給大家供大家參考,具體如下:

1. 建立popupwindow顯示的布局頁面(普通的view任意布局)

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="80dip"
  android:background="@drawable/popup_yellow_window_bg"
  android:orientation="horizontal" >
  <TextView
      android:id="@+id/popupwindow_app_uninstall_text"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="center_horizontal"
      android:layout_marginBottom="5dip"
      android:layout_marginTop="5dip"
      android:drawableTop="@drawable/kn_malware_scan_deep_click"
      android:text="卸 載"/>
</LinearLayout>

2. activity中布局加載以及填充,建立popupwindow對象,設置相應參數(shù)或?qū)傩?/p>

View contentView = View.inflate(getApplicationContext(), R.layout.popup_window, null);
LinearLayout ll_uninstall = (LinearLayout) contentView.findViewById(R.id.ll_uninstall);
//設置popupwindow內(nèi)布局組件的監(jiān)聽(與其他組件相似)
MyOnClickListener l = new MyOnClickListener(position);
ll_uninstall.setOnClickListener(l);
PopupWindow mPopupWindow = new PopupWindow(contentView, ViewGroup.LayoutParams.WRAP_CONTENT, 70);
int[] arrayOfInt = new int[2];
view.getLocationInWindow(arrayOfInt);
int x = arrayOfInt[0] + 60;
int y = arrayOfInt[1];
//1 指定popupwindow的背景  2 popupwindow能夠獲得焦點
mPopupWindow.setBackgroundDrawable(new BitmapDrawable());
mPopupWindow.setFocusable(true);
mPopupWindow.showAtLocation(view, Gravity.LEFT|Gravity.TOP, x, y);
//在合適位置取消popupwindow顯示
mPopupWindow.dismiss();

更多關于Android相關內(nèi)容感興趣的讀者可查看本站專題:《Android窗口相關操作技巧總結(jié)》、《Android開發(fā)入門與進階教程》、《Android調(diào)試技巧與常見問題解決方法匯總》、《Android基本組件用法總結(jié)》、《Android視圖View技巧總結(jié)》、《Android布局layout技巧總結(jié)》及《Android控件用法總結(jié)

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

  • Android實現(xiàn)固定屏幕顯示的方法

    Android實現(xiàn)固定屏幕顯示的方法

    這篇文章主要介紹了Android實現(xiàn)固定屏幕顯示的方法,實例分析了Android屏幕固定顯示所涉及的相關技巧,具有一定參考借鑒價值,需要的朋友可以參考下
    2015-07-07
  • Android Studio打包.so庫到apk中實例詳解

    Android Studio打包.so庫到apk中實例詳解

    這篇文章主要介紹了Android Studio打包.so庫到apk中實例詳解的相關資料,需要的朋友可以參考下
    2017-04-04
  • Android Studio 修改類的默認注釋圖文教程

    Android Studio 修改類的默認注釋圖文教程

    這篇文章主要介紹了Android Studio 修改類的默認注釋圖文教程,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-03-03
  • android listview進階實例分享

    android listview進階實例分享

    這篇文章主要介紹了android listview進階實例分享,具有一定借鑒價值,需要的朋友可以參考下
    2018-01-01
  • 深入解析Android App的LayoutInflate布局

    深入解析Android App的LayoutInflate布局

    這篇文章主要介紹了Android App的LayoutInflate布局,對LayoutInflate編寫中經(jīng)常被無解及產(chǎn)生錯誤的地方進行了深入說明,需要的朋友可以參考下
    2016-04-04
  • Android自定義狀態(tài)欄顏色與應用標題欄顏色一致

    Android自定義狀態(tài)欄顏色與應用標題欄顏色一致

    看IOS上的應用,應用中狀態(tài)欄的顏色總能與應用標題欄顏色保持一致,用戶體驗很不錯,對于這種效果怎么實現(xiàn)的呢?下面小編給大家分享android自定義狀態(tài)欄顏色與應用標題欄顏色一致的實現(xiàn)方法,一起看看吧
    2016-09-09
  • Android啟動頁用戶相關政策彈框的實現(xiàn)代碼

    Android啟動頁用戶相關政策彈框的實現(xiàn)代碼

    這篇文章主要介紹了Android啟動頁用戶相關政策彈框的實現(xiàn)方法,本文通過實例代碼給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2020-05-05
  • Android 6.0區(qū)別U盤和SD卡設備的方法詳解

    Android 6.0區(qū)別U盤和SD卡設備的方法詳解

    今天小編就為大家分享一篇Android 6.0區(qū)別U盤和SD卡設備的方法詳解,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2018-08-08
  • Android PopupMenu彈出菜單的實現(xiàn)

    Android PopupMenu彈出菜單的實現(xiàn)

    這篇文章主要介紹了 Android PopupMenu彈出菜單的實現(xiàn)的相關資料,希望通過本文能幫助到大家,實現(xiàn)這樣的功能,需要的朋友可以參考下
    2017-10-10
  • 最新評論