彈出一個(gè) PopupWindows

new PopupWindows(mContext, noScrollgridview);

public class PopupWindows extends PopupWindow {

    public PopupWindows(Context mContext, View parent) {

        View view = View
                .inflate(mContext, R.layout.item_popupwindows, null);
        view.startAnimation(AnimationUtils.loadAnimation(mContext,
                R.anim.fade_ins));
        LinearLayout ll_popup = (LinearLayout) view
                .findViewById(R.id.ll_popup);
        ll_popup.startAnimation(AnimationUtils.loadAnimation(mContext,
                R.anim.push_bottom_in_2));

        setWidth(ViewGroup.LayoutParams.FILL_PARENT);
        setHeight(ViewGroup.LayoutParams.FILL_PARENT);
        setBackgroundDrawable(new BitmapDrawable());
        setFocusable(true);
        setOutsideTouchable(true);
        setContentView(view);
        showAtLocation(parent, Gravity.BOTTOM, 0, 0);
        update();

        Button bt1 = (Button) view
                .findViewById(R.id.item_popupwindows_camera);
        Button bt2 = (Button) view
                .findViewById(R.id.item_popupwindows_Photo);
        Button bt3 = (Button) view
                .findViewById(R.id.item_popupwindows_cancel);
        bt1.setText("刪除");
        bt1.setTextColor(Color.RED);
        bt2.setText("取消");
        bt1.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {

// photo();
dismiss();
}
});
bt2.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Intent intent = new Intent(EditCourseActivity.this,ChosePhotoActivity.class);
// startActivity(intent);
dismiss();
}
});
bt3.setVisibility(View.GONE);
}
}

動(dòng)畫(huà)
<?xml version="1.0" encoding="utf-8"?>
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="20"
android:fromAlpha="0.0"
android:toAlpha="1.0" />

動(dòng)畫(huà)
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="20"
android:fromYDelta="100%"
android:interpolator="@android:anim/decelerate_interpolator"
android:toYDelta="0" />

布局文件
<?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="match_parent"
android:background="@drawable/bg_transparent" >

<LinearLayout
    android:id="@+id/ll_popup"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:background="#ffffff"
    android:orientation="vertical" >

    <TextView
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="#ff495a" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="55dp"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/item_popupwindows_camera"
            android:layout_width="match_parent"
            android:layout_height="55dp"
            android:background="@drawable/bt_nobgd"
            android:textColor="#585858"
            android:textSize="18sp"
            android:text="拍照" />
    </LinearLayout>

    <TextView
        android:layout_marginLeft="80dp"
        android:layout_width="match_parent"
        android:layout_height="1px"
        android:background="#f2f2f2" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="55dp"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/item_popupwindows_Photo"
            android:layout_width="match_parent"
            android:layout_height="55dp"
            android:background="@drawable/bt_nobgd"
            android:textColor="#585858"
            android:textSize="18sp"
            android:text="從相冊(cè)中選取" />
    </LinearLayout>

    <TextView
        android:layout_width="match_parent"
        android:layout_height="2dp"
        android:background="#f3f3f3" />

    <Button
        android:id="@+id/item_popupwindows_cancel"
        android:layout_width="match_parent"
        android:layout_height="55dp"
        android:background="@drawable/bt_nobgd"
        android:textColor="#585858"
        android:textSize="18sp"
        android:text="取消" />
</LinearLayout>

</RelativeLayout>

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市禀倔,隨后出現(xiàn)的幾起案子战坤,更是在濱河造成了極大的恐慌,老刑警劉巖福稳,帶你破解...
    沈念sama閱讀 216,591評(píng)論 6 501
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件涎拉,死亡現(xiàn)場(chǎng)離奇詭異,居然都是意外死亡,警方通過(guò)查閱死者的電腦和手機(jī)鼓拧,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,448評(píng)論 3 392
  • 文/潘曉璐 我一進(jìn)店門半火,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái),“玉大人季俩,你說(shuō)我怎么就攤上這事钮糖。” “怎么了种玛?”我有些...
    開(kāi)封第一講書(shū)人閱讀 162,823評(píng)論 0 353
  • 文/不壞的土叔 我叫張陵藐鹤,是天一觀的道長(zhǎng)。 經(jīng)常有香客問(wèn)我赂韵,道長(zhǎng)娱节,這世上最難降的妖魔是什么? 我笑而不...
    開(kāi)封第一講書(shū)人閱讀 58,204評(píng)論 1 292
  • 正文 為了忘掉前任祭示,我火速辦了婚禮肄满,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘质涛。我一直安慰自己稠歉,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,228評(píng)論 6 388
  • 文/花漫 我一把揭開(kāi)白布汇陆。 她就那樣靜靜地躺著怒炸,像睡著了一般。 火紅的嫁衣襯著肌膚如雪毡代。 梳的紋絲不亂的頭發(fā)上阅羹,一...
    開(kāi)封第一講書(shū)人閱讀 51,190評(píng)論 1 299
  • 那天,我揣著相機(jī)與錄音教寂,去河邊找鬼捏鱼。 笑死,一個(gè)胖子當(dāng)著我的面吹牛酪耕,可吹牛的內(nèi)容都是我干的导梆。 我是一名探鬼主播,決...
    沈念sama閱讀 40,078評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼迂烁,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼看尼!你這毒婦竟也來(lái)了?” 一聲冷哼從身側(cè)響起婚被,我...
    開(kāi)封第一講書(shū)人閱讀 38,923評(píng)論 0 274
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤狡忙,失蹤者是張志新(化名)和其女友劉穎,沒(méi)想到半個(gè)月后址芯,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體灾茁,經(jīng)...
    沈念sama閱讀 45,334評(píng)論 1 310
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡窜觉,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,550評(píng)論 2 333
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了北专。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片禀挫。...
    茶點(diǎn)故事閱讀 39,727評(píng)論 1 348
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖拓颓,靈堂內(nèi)的尸體忽然破棺而出语婴,到底是詐尸還是另有隱情,我是刑警寧澤驶睦,帶...
    沈念sama閱讀 35,428評(píng)論 5 343
  • 正文 年R本政府宣布砰左,位于F島的核電站,受9級(jí)特大地震影響场航,放射性物質(zhì)發(fā)生泄漏缠导。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,022評(píng)論 3 326
  • 文/蒙蒙 一溉痢、第九天 我趴在偏房一處隱蔽的房頂上張望僻造。 院中可真熱鬧,春花似錦孩饼、人聲如沸髓削。這莊子的主人今日做“春日...
    開(kāi)封第一講書(shū)人閱讀 31,672評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)立膛。三九已至,卻和暖如春梯码,著一層夾襖步出監(jiān)牢的瞬間旧巾,已是汗流浹背。 一陣腳步聲響...
    開(kāi)封第一講書(shū)人閱讀 32,826評(píng)論 1 269
  • 我被黑心中介騙來(lái)泰國(guó)打工忍些, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人坎怪。 一個(gè)月前我還...
    沈念sama閱讀 47,734評(píng)論 2 368
  • 正文 我出身青樓罢坝,卻偏偏與公主長(zhǎng)得像,于是被迫代替她去往敵國(guó)和親搅窿。 傳聞我的和親對(duì)象是個(gè)殘疾皇子嘁酿,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,619評(píng)論 2 354

推薦閱讀更多精彩內(nèi)容