In this blog, you can learn the following items:
Run, the interface is two buttons
Custom Dialog
Custom alertdialog
Complete source code: http://download.csdn.net/source/3512363
1. Activity Code
Package mark. zhang; import android. app. activity; import android
Custom network loading dialog box
When the App interacts with the server over the network, a prompt loading box is required. In this case, you can customize a dialog box for loading. The Code is as follows:
Public class LoadingDialog extends Dialog {Private static final int CHANGE_TITLE_WHAT = 1;Private static final in
Sometimes you need to customize the dialog box, you can use Alterdialog.bulider, such as the following code snippet1 New Alertdialog.builder (self) 2 3 . Settitle ("title")45 . Setmessage ("Simple message box")67 NULL )89 . Show ();The code snippet above is from: http://blog.csdn.net/chenlei1889/article/details/6267406What I want to record here is to implement a
In Android, how does one process the Dialog box Dialog in the Activity source code? androiddialog
For Android, if you leave the Activity, you will not be able to talk about development. Are you familiar with the Implementation Principles of the Activity? I am not familiar with the source code. Next, let's take a look a
Objective
Android often use dialog to implement some hints and some special effects, and the style is not the same, each time have to look up a lot of information, it is not necessarily able to solve. dialog box is a good thing to create a simple and practical. In the current development, many developers prefer to use the activity instead of the
; Private Static int mtheme = R. style. mydialog;/*** custom dialog ** @ Param context * @ Param activity * The activity where the dialog is located, click "OK" and finish the text on the activity * @ Param title * text content * @ Param btnstring * button * @ Param Theme * style */Public mycameradialog (context Context, int theme) {super (context, theme); this.
Functional Requirements:
When users click on the "Phone theft" button on the main page, they determine if the user has set a password.
If not set, the Enter Password dialog box pops up
If it is set, the Set Password dialog box pops up
The user's password is MD5 encrypted and then stored in memory
Technical points:-Use of custom
We know that the style of the dialog box provided by the Android system is a little simple. If your application is gorgeous and coupled with a simple dialog box, it seems out of place.
So ...... we can use reflection technology to prevent the close of the dialog box, set the transparency of the
Summary: Create dialog box A dialog box is typically a small window that appears above the current activity. The activity below loses focus, and the dialog accepts all user interaction. Dialog boxes are typically used to cue information and small functions that are directly related to the current application. The
users to select a time. Please refer to the hello timepicker guide.
If you want to customize your own dialog box, you can expand and define a new layout on the basic dialog box object or any subclass dialog box listed above. See the section creating a custom dialog in the
Activity is one of the 4 application components of the Android system. The activity shown by the traditional method is full of the whole screen, that is, full screen activity. In fact, the activity can be displayed not only in full screen, but also directly on the screen like a dialog box. You can also close the activity by clicking anywhere on the screen, including within the activity and outside the activ
Only down-to-earth people can say: road, at my feet.This content: Dialog dialog boxExample three: information content is a simple view typeHere is the Mainactivity.java main interface file:public class Mainactivity extends activity{private Button b; @Overrideprotected void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate); Setcontentview (R.layout.activity_main); b= (Button) Findview
1. Display the Mainactivity as a dialog box, first in the Androidmanifest.xml file, stating that the theme of the activity uses a custom dialog box style.activityandroid:name=".MainActivity"android:label="@string/activity_custom_dialog"android:theme="@style/Theme.CustomDialog">intent-filter>action android:name="android.intent.action.MAIN" />category android:name=
Android.widget.imageview;import Android.widget.listview;import Android.widget.textview;public class Mainactivity extends Activity {//define two static strings private static final String Dialog_icon = "Icon";p rivate static final String dialog_title = "TITLE";//the variable that declares the button type Button1private button button1;// A variable that declares a type of button Button2private button button2;//declares a variable of view type Viewprivate view view;//declares a variable of type Li
Sometimes I don't have to do some checking by clicking on the button. But do not want to close the dialog box (the system by default click on any button to close the dialog box), processing methods such as the following: Under the Click event to add such as the following code:
Try
{
Field field = Dialog.getclass ()
. Getsuperclass (). Getdeclaredfield (
"Mshowing");
Field.setaccessible (true);
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.