Android實(shí)現(xiàn)底部彈出按鈕菜單升級(jí)版
本文實(shí)例為大家分享了Android實(shí)現(xiàn)底部彈出按鈕菜單的具體代碼,在Android實(shí)現(xiàn)底部緩慢彈出菜單的升級(jí),供大家參考,具體內(nèi)容如下
只貼出關(guān)鍵代碼
case R.id.myself_share:
//我的分享
getShareMune();
getShareMune()
private void getShareMune() {
final Dialog mdialog = new Dialog(getActivity(), R.style.photo_dialog);
mdialog.setContentView(View.inflate(getActivity(), R.layout.layout_popwindow, null));
// 彈出對(duì)話框
Window window = mdialog.getWindow();
WindowManager.LayoutParams lp = window.getAttributes();
lp.gravity = Gravity.BOTTOM;
lp.y = 20;
window.setContentView(R.layout.layout_popwindow);
final Button qq = (Button) window.findViewById(R.id.btn_QQ);
final Button sina = (Button) window.findViewById(R.id.btn_sina);
final Button firend = (Button) window.findViewById(R.id.btn_wechatfirend);
final Button firend1 = (Button) window.findViewById(R.id.btn_wechatfirend1);
final Button more = (Button) window.findViewById(R.id.btn_more);
final Button back = (Button) window.findViewById(R.id.btn_cancel);
//QQ
qq.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showZiDingYi(QQ.NAME);
mdialog.dismiss();
}
});
//新浪
sina.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// showZiDingYi(SinaWeibo.NAME);
mdialog.dismiss();
}
});
//微信好友
firend.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showZiDingYi(Wechat.NAME);
mdialog.dismiss();
}
});
//微信朋友圈
firend1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showZiDingYi(WechatMoments.NAME);
mdialog.dismiss();
}
});
//更多
more.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mdialog.dismiss();
}
});
//取消
back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
mdialog.show();
}
這里還有個(gè)Style
<style name="photo_dialog" parent="android:style/Theme.Dialog">
<item name="android:windowAnimationStyle">@style/AnimBottom</item>
<item name="android:windowFrame">@null</item>
<!-- 邊框 -->
<item name="android:windowIsFloating">true</item>
<!-- 是否浮現(xiàn)在activity之上 -->
<item name="android:windowIsTranslucent">true</item>
<!-- 半透明 -->
<item name="android:windowNoTitle">true</item>
<!-- 無標(biāo)題 -->
<item name="android:windowBackground">@android:color/transparent</item>
<!-- 背景透明 -->
<item name="android:backgroundDimEnabled">true</item>
<!-- 模糊 -->
</style>
還有一個(gè)XML
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<LinearLayout
android:id="@+id/pop_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:id="@+id/btn_QQ"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/button_alter_top_radiu"
android:padding="@dimen/standard_30px"
android:text="分享到QQ"
android:textColor="@color/black" />
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/color_dialog_line" />
<Button
android:id="@+id/btn_sina"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/linearlayout_border_no_radiu"
android:padding="@dimen/standard_30px"
android:text="分享到新浪"
android:textColor="@color/black" />
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/color_dialog_line" />
<Button
android:id="@+id/btn_wechatfirend"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/linearlayout_border_no_radiu"
android:padding="@dimen/standard_30px"
android:text="分享到微信好友"
android:textColor="@color/black" />
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/color_dialog_line" />
<Button
android:id="@+id/btn_wechatfirend1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/linearlayout_border_no_radiu"
android:padding="@dimen/standard_30px"
android:text="分享到微信朋友圈"
android:textColor="@color/black" />
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:background="@color/color_dialog_line" />
<Button
android:id="@+id/btn_more"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/button_alter_bottom_radiu"
android:padding="@dimen/standard_30px"
android:text="分享到更多..."
android:textColor="@color/black" />
<Button
android:layout_marginTop="@dimen/standard_20px"
android:id="@+id/btn_cancel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/button_radius_white_lemonchiffon"
android:padding="@dimen/standard_30px"
android:text="取消"
android:textColor="@color/black" />
</LinearLayout>
</RelativeLayout>
上效果圖

以上就是本文的全部內(nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
Android編程之簡單計(jì)時(shí)器實(shí)現(xiàn)方法
這篇文章主要介紹了Android編程之簡單計(jì)時(shí)器實(shí)現(xiàn)方法,涉及Android開發(fā)中ContextMenu及Chronometer的相關(guān)使用技巧,需要的朋友可以參考下2016-01-01
Android仿微信、qq點(diǎn)擊右上角加號(hào)彈出操作框
這篇文章主要為大家詳細(xì)介紹了Android仿微信、qq點(diǎn)擊右上角加號(hào)彈出操作框,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-04-04
Android編程設(shè)計(jì)模式之抽象工廠模式詳解
這篇文章主要介紹了Android編程設(shè)計(jì)模式之抽象工廠模式,結(jié)合實(shí)例形式詳細(xì)分析了Android抽象工廠模式的概念、原理、使用方法及相關(guān)注意事項(xiàng),需要的朋友可以參考下2017-12-12
ANDROID BottomNavigationBar底部導(dǎo)航欄的實(shí)現(xiàn)示例
本篇文章主要介紹了ANDROID BottomNavigationBar底部導(dǎo)航欄的實(shí)現(xiàn)示例,非常具有實(shí)用價(jià)值,需要的朋友可以參考下2017-10-10
簡單實(shí)現(xiàn)Android計(jì)算器功能
這篇文章主要為大家詳細(xì)介紹了自己動(dòng)手實(shí)現(xiàn)的Android計(jì)算器功能,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-01-01
Android 開源項(xiàng)目側(cè)邊欄菜單(SlidingMenu)使用詳解
SlidingMenu的是一種比較新的設(shè)置界面或配置界面效果,在主界面左滑或者右滑出現(xiàn)設(shè)置界面,能方便的進(jìn)行各種操作.目前有大量的應(yīng)用都在使用這一效果。如Evernote、Google+、Foursquare等,國內(nèi)的豌豆夾,人人,360手機(jī)助手等都使用SlidingMenu的界面方案。2016-05-05
Android實(shí)現(xiàn)系統(tǒng)日歷同步日程
這篇文章主要為大家詳細(xì)介紹了Android實(shí)現(xiàn)系統(tǒng)日歷同步日程,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2021-04-04
Android利用zxing快速集成二維碼掃描的實(shí)例教程
最近二維碼真是越來越火了,隨便電視上、網(wǎng)絡(luò)上、商場(chǎng)里,到處都是二維碼,所以下面這篇文章我們就來給大家介紹關(guān)于Android利用zxing快速集成二維碼掃描的相關(guān)資料,需要的朋友可以參考借鑒,下面隨著小編來一起看看吧。2017-09-09
Android自定義view實(shí)現(xiàn)拖動(dòng)小球移動(dòng)
這篇文章主要為大家詳細(xì)介紹了Android自定義view實(shí)現(xiàn)拖動(dòng)小球移動(dòng),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2020-11-11

