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

Android怎么實現(xiàn)簡單的popupwindow提示框

這篇文章主要介紹Android怎么實現(xiàn)簡單的popupwindow提示框,文中介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們一定要看完!

讓客戶滿意是我們工作的目標(biāo),不斷超越客戶的期望值來自于我們對這個行業(yè)的熱愛。我們立志把好的技術(shù)通過有效、簡單的方式提供給客戶,將通過不懈努力成為客戶在信息化領(lǐng)域值得信任、有價值的長期合作伙伴,公司提供的服務(wù)項目有:申請域名虛擬主機(jī)、營銷軟件、網(wǎng)站建設(shè)、潞州網(wǎng)站維護(hù)、網(wǎng)站推廣。

Popupwindow大家肯定都特別熟悉了 像一般的提示框的話我們會用Dialog來做 但是隨著設(shè)計要求的不斷提高,App中各式各樣的提示框都有,很明顯普通的Dialog實現(xiàn)起來就比較吃力了 所以用Popupwindow來實現(xiàn)是最好不過了 ,于是我也自己寫了一個popupwindow彈出的一個方法,代碼量少簡單靈活 先看一下效果圖

Android怎么實現(xiàn)簡單的popupwindow提示框

大致效果就是這樣 當(dāng)然你也可以將layout中的布局換成自己的布局 接下來是代碼

private void ejectPopup() {
 
    View parent = ((ViewGroup) this.findViewById(android.R.id.content)).getChildAt(0);
    View popView = View.inflate(this, R.layout.details_share, null);
 
 
    int width = getResources().getDisplayMetrics().widthPixels;
    int height = getResources().getDisplayMetrics().heightPixels;
//    int i = height /5*2;
     popWindow = new PopupWindow(popView, width, ViewGroup.LayoutParams.WRAP_CONTENT);
    popWindow.setAnimationStyle(R.style.Search_PopupWindowAnimation);
    popWindow.setFocusable(true);
    popWindow.setOutsideTouchable(false);// 設(shè)置同意在外點(diǎn)擊消失
    ColorDrawable dw = new ColorDrawable(0x30000000);
    popWindow.setBackgroundDrawable(dw);
    popWindow.showAtLocation(parent, Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0);
    popWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);//被home鍵擋住
    //給popup中的按鈕做監(jiān)聽
    WindowManager.LayoutParams lp = getWindow().getAttributes();
    lp.alpha = (float) 0.7; //0.0-1.0
    getWindow().setAttributes(lp);
    popWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
      @Override
      public void onDismiss() {
        WindowManager.LayoutParams lp = getWindow().getAttributes();
        lp.alpha = (float) 1; //0.0-1.0
        getWindow().setAttributes(lp);
      }
    });
}

這個就是調(diào)用的方法  背景變暗可以通過這段代碼來實現(xiàn)

 popWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
      @Override
      public void onDismiss() {
        WindowManager.LayoutParams lp = getWindow().getAttributes();
        lp.alpha = (float) 1; //0.0-1.0
        getWindow().setAttributes(lp);
      }
    });

當(dāng)讓也可以讓ui妹子給你切一個透明的背景圖片 
最后是layout中的代碼

<?xml version="1.0" encoding="utf-8"?>
<com.zhy.autolayout.AutoLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:orientation="vertical" android:layout_width="match_parent"
  android:background="#fff"
  android:layout_height="239dp">
 
  <com.zhy.autolayout.AutoLinearLayout
    android:gravity="center"
    android:layout_width="match_parent"
    android:layout_height="51dp">
 
    <TextView
      android:text="請選擇分享平臺"
      android:textColor="#29292a"
      android:textSize="18sp"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content" />
  </com.zhy.autolayout.AutoLinearLayout>
 
  <TextView
    android:background="@color/divider_color"
    android:layout_width="match_parent"
    android:layout_height="1dp" />
  
  <com.zhy.autolayout.AutoLinearLayout
    android:layout_marginBottom="10dp"
    android:layout_width="match_parent"
    android:layout_height="132dp">
    <com.zhy.autolayout.AutoRelativeLayout
      android:id="@+id/share_WX"
      android:layout_marginLeft="13dp"
      android:layout_width="0dp"
      android:layout_weight="1"
      android:layout_height="match_parent">
 
      <ImageView
        android:id="@+id/share_WX_icon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        app:srcCompat="@drawable/wechat" />
 
      <TextView
        android:text="微信"
        android:layout_marginTop="6dp"
        android:layout_below="@id/share_WX_icon"
        android:layout_centerHorizontal="true"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
    </com.zhy.autolayout.AutoRelativeLayout>
    <com.zhy.autolayout.AutoRelativeLayout
      android:id="@+id/share_WXPYQ"
      android:layout_width="0dp"
      android:layout_weight="1"
      android:layout_height="match_parent">
 
      <ImageView
        android:id="@+id/share_WXPYQ_icon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        app:srcCompat="@drawable/circleoffriends" />
 
      <TextView
        android:text="朋友圈"
        android:layout_marginTop="6dp"
        android:layout_below="@id/share_WXPYQ_icon"
        android:layout_centerHorizontal="true"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
    </com.zhy.autolayout.AutoRelativeLayout>
    <com.zhy.autolayout.AutoRelativeLayout
      android:layout_width="0dp"
      android:id="@+id/share_QQ"
      android:layout_weight="1"
      android:layout_height="match_parent">
 
      <ImageView
        android:id="@+id/share_QQ_icon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        app:srcCompat="@drawable/qq" />
 
      <TextView
        android:text="QQ"
        android:layout_marginTop="6dp"
        android:layout_below="@id/share_QQ_icon"
        android:layout_centerHorizontal="true"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
    </com.zhy.autolayout.AutoRelativeLayout>
    <com.zhy.autolayout.AutoRelativeLayout
      android:layout_width="0dp"
      android:layout_weight="1"
      android:id="@+id/share_QQKJ"
      android:layout_height="match_parent">
 
      <ImageView
        android:id="@+id/share_QQKJ_icon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        app:srcCompat="@drawable/zone" />
 
      <TextView
        android:text="空間"
        android:layout_marginTop="6dp"
        android:layout_below="@id/share_QQKJ_icon"
        android:layout_centerHorizontal="true"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
    </com.zhy.autolayout.AutoRelativeLayout>
 
    <com.zhy.autolayout.AutoRelativeLayout
      android:id="@+id/share_WB"
      android:layout_width="0dp"
      android:layout_height="match_parent"
      android:layout_marginRight="13dp"
      android:layout_weight="1">
 
      <ImageView
        android:id="@+id/share_WB_icon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        app:srcCompat="@drawable/weibo" />
 
      <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/share_WB_icon"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="6dp"
        android:text="微博" />
    </com.zhy.autolayout.AutoRelativeLayout>
 
  </com.zhy.autolayout.AutoLinearLayout>
  <TextView
    android:background="@color/divider_color"
    android:layout_width="match_parent"
    android:layout_height="1dp" />
  <com.zhy.autolayout.AutoLinearLayout
    android:id="@+id/share_cancel"
    android:gravity="center"
    android:layout_width="match_parent"
    android:layout_height="50dp">
    <TextView
      android:gravity="center"
      android:textSize="15sp"
      android:textColor="#2d2d2d"
      android:text="取消"
      android:layout_width="wrap_content"
      android:layout_height="match_parent" />
  </com.zhy.autolayout.AutoLinearLayout>
</com.zhy.autolayout.AutoLinearLayout>

ok  沒了

以上是“Android怎么實現(xiàn)簡單的popupwindow提示框”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!

網(wǎng)站名稱:Android怎么實現(xiàn)簡單的popupwindow提示框
轉(zhuǎn)載來于:http://chinadenli.net/article2/jsipic.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供營銷型網(wǎng)站建設(shè)、網(wǎng)站建設(shè)、網(wǎng)站營銷網(wǎng)站設(shè)計公司、全網(wǎng)營銷推廣小程序開發(fā)

廣告

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

成都定制網(wǎng)站網(wǎng)頁設(shè)計
日本深夜福利在线播放| 日韩成人动画在线观看| 国产对白老熟女正在播放| 东北老熟妇全程露脸被内射| 久久精品国产99精品最新| 亚洲免费视频中文字幕在线观看| 亚洲日本久久国产精品久久| 国产人妻熟女高跟丝袜| 亚洲一区二区三区四区性色av| 国产精品亚洲综合色区韩国| 欧美日韩一区二区午夜| 午夜色午夜视频之日本| 东京热电东京热一区二区三区| 国产精品久久三级精品| 亚洲欧美日韩综合在线成成| 亚洲一区二区三区熟女少妇 | 国内精品偷拍视频久久| 日韩特级黄片免费在线观看| 国产又粗又猛又大爽又黄| 欧洲自拍偷拍一区二区| 黄男女激情一区二区三区| 好吊色欧美一区二区三区顽频| 国产精品丝袜一二三区| 在线观看视频日韩精品 | 精品熟女少妇av免费久久野外| 日本一区二区三区久久娇喘| 亚洲高清亚洲欧美一区二区| 久久福利视频视频一区二区| 97人妻精品一区二区三区男同| 狠狠干狠狠操亚洲综合| 亚洲中文字幕在线观看四区| 欧美激情视频一区二区三区| 精品人妻av区波多野结依| 天海翼高清二区三区在线| 欧美日韩欧美国产另类| 免费福利午夜在线观看| 日本欧美三级中文字幕| 玩弄人妻少妇一区二区桃花| 国产精品香蕉一级免费| 成人午夜在线视频观看| 亚洲国产精品久久综合网|