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. vs2017 vs2019配置sqlite3连接引擎(驱动)指南(二)vs2019续集

    在写完上一篇博客后,一觉醒来,又又又又不行了,介绍一个终极大招,如果你的fuck vs又提示无法打开sqlite3.h的问题 环境win10  vs2019 debug x86 实在没心情写文字了,直 ...

  2. 最全面的C/C++编码规范总结

    C语言是面向过程的,而C++是面向对象的 对于不同的编程语言来说,具体的编码规范可以有很大的不同,但是其宗旨都是一致的,就是保证代码在高质量完成需求的同时具备良好的可读性.可维护性.例如我们可以规定某 ...

  3. svn检出两种方式的区别

    第一种是“做为新项目检出,并使用新建项目向导进行配置(仅当资源库中不存在.project工程文件时才可用,意思是如果代码库中有了这个工程文件,那么它就认为这是一个信息完整的工程,在导入的过程中就不需要 ...

  4. ipfs camp course c demo exercise 1

    目录 aim: my bugs 解决ipfs 的 cros 问题的方法 result final code for c1 aim: 首先咱们把 broswer 和 自己的api 连接起来(要显示出来自 ...

  5. 【译】高级T-SQL进阶系列 (二)【下篇】:使用 APPLY操作符

    [译注:此文为翻译,由于本人水平所限,疏漏在所难免,欢迎探讨指正] 原文链接:传送门. 使用OUTER APPLY 操作符 OUTER APPLY操作符工作起来和CROSS APPLY比较类似.唯一的 ...

  6. Java连载66-数组的两种初始化方式

    一.数组 1.数组中存储元素的类型是统一的,每一个元素在内存中所占用的空间大小是相同的,知道数组的首元素的内存地址,要查找的元素只要知道下标,就可以快速的计算出偏移量,通过首元素内存地址加上偏移量,就 ...

  7. 一个不会coding的girl Linux日常之命令awk

    Linux日常之命令awk 参考:http://www.zsythink.net/archives/tag/awk/ 一. 命令awk简介 1. awk是一种编程语言,用于对文本和数据进行处理的 2. ...

  8. python合并大量ts文件成mp4格式(ps:上限是450,亲测)

    import os #exec_str = r'copy /b ts/c9645620628078.ts+ts/c9645620628079.ts ts/1.ts' #os.system(exec_s ...

  9. 机器学习之SVM多分类

    实验要求数据说明 :数据集data4train.mat是一个2*150的矩阵,代表了150个样本,每个样本具有两维特征,其类标在truelabel.mat文件中,trainning sample 图展 ...

  10. Mybatis笔记一

    课程安排: mybatis和springmvc通过订单商品 案例驱动 第一天:基础知识(重点,内容量多) 对原生态jdbc程序(单独使用jdbc开发)问题总结 mybatis框架原理 (掌握) myb ...