dialog box for "Go" hover

Source: Internet
Author: User

Paste the display first, for reference only:

The code is as follows:

1. Custom Dialog

public class Selectdialog extends alertdialog{

Public Selectdialog (context context, int theme) {
Super (context, theme);
}

Public Selectdialog (Context context) {
Super (context);
}

@Override
protected void OnCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);
Setcontentview (R.layout.slt_cnt_type);
}
}

2. layout file Slt_cnt_type.xml code

<?xml version= "1.0" encoding= "Utf-8"?>
<linearlayout
Xmlns:android= "Http://schemas.android.com/apk/res/android"
android:orientation= "Vertical"
android:padding= "10DP" android:layout_width= "115DP" android:layout_height= "wrap_content" android:background= "@ Color/blue ">
<button android:layout_height= "wrap_content" android:background= "#00000000" android:layout_width= "Fill_parent" android:text= "All Contacts" android:paddingtop= "5DP" android:paddingbottom= "5DP" android:paddingleft= "10DP" Android: Gravity= "left|center_vertical" android:id= "@+id/btnsltcntall" ></Button>
<button android:layout_height= "wrap_content" android:background= "#00000000" style= "@drawable/greenhand_button" android:text= "Plump user" android:gravity= "left|center_vertical" android:paddingbottom= "5DP" android:paddingtop= "5DP" android:paddingleft= "10DP" android:paddingright= "10DP" android:layout_width= "fill_parent" android:id= "@+id/ Btnsltgudonguser "></Button>
<button style= "@drawable/greenhand_button" android:background= "#00000000" android:layout_height= "Wrap_content" Android:layout_width= "Fill_parent" android:text= "Recommended user" android:gravity= "left|center_vertical" android:paddingTop= "5DP" android:paddingbottom= "5DP" android:paddingleft= "10DP" android:id= "@+id/btnsltrecommend" ></Button>
</LinearLayout>

3. Color Color.xml Code

<?xml version= "1.0" encoding= "Utf-8"?>
<resources>
<color name= "Transparent" > #00000000 </color>
</resources>

4. Style Style.xml Code

<?xml version= "1.0" encoding= "Utf-8"?>
<resources>
<style name= "Dialog" parent= "@android: Style/theme.dialog" >
<item name= "Android:windowframe" > @null </item><!--border--
<item name= "android:windowisfloating" >true</item>< whether the!--appears above activity--
<item name= "android:windowistranslucent" >false</item><!--Translucent--
<item name= "Android:windownotitle" >true</item><!--Untitled--
<item name= "Android:windowbackground" > @color/transparent</item>< Background transparent!--
<item name= "android:backgrounddimenabled" >false</item><!--Blur--
</style>
</resources>

4. Display dialog

Selectdialog Selectdialog = new Selectdialog (this,r.style.dialog);//Create dialog and set style theme
Window win = Selectdialog.getwindow ();
Layoutparams params = new Layoutparams ();
Params.x = -80;//set X coordinate
Params.y = -60;//Set y-coordinate
Win.setattributes (params);
Selectdialog.setcanceledontouchoutside (TRUE);//Set Click Dialog outside any area to close dialog
Selectdialog.show ();

dialog box for "Go" hover

Related Article

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.