Android Dialog Bottom Popup

Source: Internet
Author: User

,
if (Dialsharedialog = = null) {Dialsharedialog = new Dialog (context, R.style.dialog);d Ialsharedialog.setcontentview ( R.layout.dialog_share);d Ialsharedialog.setcanceledontouchoutside (TRUE);//Gets the form of the dialog box. and set the form parameters Windowmanager.layoutparams Lp=dialsharedialog.getwindow (). GetAttributes (); lp.dimamount=0.7f;        Dialsharedialog.getwindow (). Getdecorview (). setpadding (0, 0, 0, 0);        Lp.width = WindowManager.LayoutParams.MATCH_PARENT; Lp.height = Windowmanager.layoutparams.wrap_content;dialsharedialog.getwindow (). setgravity (Gravity.BOTTOM);} ImageView Weixiniv = (ImageView) Dialsharedialog.findviewbyid (R.ID.SHARE_WEIXIN_IV); ImageView friendiv = (ImageView) Dialsharedialog.findviewbyid (R.ID.SHARE_FRIEND_IV); ImageView Kongjianiv = (ImageView) Dialsharedialog.findviewbyid (R.id.share_kongjian_iv); ImageView sinaiv = (ImageView) Dialsharedialog.findviewbyid (R.ID.SHARE_SINA_IV); Weixiniv.setonclicklistener (Shareonclicklistener); Friendiv.setonclicklistener (Shareonclicklistener); Kongjianiv.setonclicklisteNER (Shareonclicklistener), Sinaiv.setonclicklistener (Shareonclicklistener);d ialsharedialog.show (); 

XML file

<?xml version= "1.0" encoding= "Utf-8"?

><relativelayout xmlns:android= "http://schemas.android.com/apk/res/android" android:id= "@+id/dialog_share_ RL "Android:layout_width=" Match_parent "android:layout_height=" wrap_content "android:background=" @android: color/t Ransparent "android:orientation=" vertical "> <linearlayout android:layout_width=" Match_parent "a ndroid:layout_height= "wrap_content" android:orientation= "vertical" android:background= "@color/public_white" > <textview android:layout_width= "match_parent" android:layout_height= "42DP" android:gravity= "center" android:text= "share to" android:textcolor= "#8d8f92" android:textsize = "16DP"/><view android:layout_width= "match_parent" android:layout_height= "0.5DP" a ndroid:layout_margintop= "10DP" android:layout_marginleft= "10DP" android:layout_marginright= "10DP" Android:background= "#e5e5e5 "/><linearlayout android:layout_width=" fill_parent "android:layout_height=" Wrap_content "Android:orie ntation= "Horizontal" > <linearlayout android:layout_width= "0dp" android:layout_height= "120DP" android:layout_weight= "1" android:gravity= "center" android:orientation= "vertical" ><imageview Andro Id:id= "@+id/share_weixin_iv" android:layout_width= "60DP" android:layout_height= "60DP" and roid:background= "@drawable/selector_share_weixin" android:contentdescription= "@null"/> <textview Android:layout_width= "Wrap_content" android:layout_height= "Wrap_content" android:gravity= " Center "android:text=" "android:textcolor=" #8d8f92 "android:layout_gravity=" Center_horizo Ntal "android:textsize=" 12DP "android:layout_margintop=" 5DP "/> </LinearLayout> <line Arlayout android:Layout_width= "0DP" android:layout_height= "120DP" android:layout_weight= "1" android:gravity= "center" android:orientation= "vertical" ><imageview android:id= "@+id/share_friend_iv" android:layout_width = "60DP" android:layout_height= "60DP" android:background= "@drawable/selector_share_friend" android:contentdescription= "@null"/> <textview android:layout_width= "Wrap_content" and roid:layout_height= "wrap_content" android:gravity= "center" android:text= "Friends Circle" Android:tex Tcolor= "#8d8f92" android:layout_gravity= "Center_horizontal" android:layout_margintop= "5DP" Android:textsize= "12DP"/> </LinearLayout> <linearlayout android:layout_width= "0DP" and roid:layout_height= "120DP" android:layout_weight= "1" android:gravity= "center" android:orientation= "ve Rtical "><imageview Android:id= "@+id/share_kongjian_iv" android:layout_width= "60DP" android:layout_height= "60DP" android:background= "@drawable/selector_share_kongjian" android:contentdescription= "@null"/> & Lt TextView android:layout_width= "wrap_content" android:layout_height= "Wrap_content" Android : gravity= "center" android:text= "QQ Space" android:textcolor= "#8d8f92" android:layout_gravity= "Center_horizontal" android:layout_margintop= "5DP" android:textsize= "12DP"/> </linearlayou t> <linearlayout android:layout_width= "0DP" android:layout_height= "120DP" Android:layout_we ight= "1" android:gravity= "center" android:orientation= "vertical" ><imageview android:id= "@+id/share_ Sina_iv "android:layout_width=" 60DP "android:layout_height=" 60DP "android:background=" @dr Awable/selector_share_sina "android:contentdescription=" @null "/> <textview android:layout_width=" Wrap_conten T "android:layout_height=" wrap_content "android:gravity=" center "android:text=" Sina Weibo " Android:textcolor= "#8d8f92" android:layout_gravity= "Center_horizontal" Android:layout_margint op= "5DP" android:textsize= "12DP"/> </LinearLayout></LinearLayout> </linearlayout>&l T;/relativelayout>

Define your own pop-up layer style

<!--define dialog interface--<style name= "dialog" parent= "@android: Style/theme.dialog" > <item name= "android Oid:windowframe "> @null </item> <!--border--<item name=" android:windowisfloating ">true</item& Gt        <!--suspended on activity--<item name= "Android:windowistranslucent" >true</item> <!--Translucent-- <item name= "Android:windownotitle" >true</item> <!--Untitled--<item name= "Android:backgrou nd "> @android:color/transparent</item> <!--background Transparent--<item name=" Android:windowbackground "> @and roid:color/transparent</item> <!--background Transparent--<item name= "android:backgrounddimenabled" >true</it Em> <!--Blur--<item name= "Android:backgrounddimamount" >0.6</item> <!--Grayscale---& Lt;item name= "Android:windowcontentoverlay" > @null </item> <!--dialog box is shaded-<item name= "Android:wi Ndowanimationstyle "&GT, @null </item> < animation effect!--pop-up or entry-<item name= "Android:colorbackgroundcachehint" > @null </ite M> <!--background cache color-</style>



Android Dialog Bottom Popup

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.