仿照Android标准API写的各种形式的弹出框
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写的各种形式的弹出框的更多相关文章
- Android 如何利用Activity的Dialog风格完成弹出框设计
在我们使用Dialog时,如果需要用到很多自己设计的控件,虽然可以让弹出框显示出我们需要的界面,但却无法找到地方完成控制代码的编写,如何解决这个问题呢,我们可以将Activity伪装成Dialog弹出 ...
- 【Python+selenium Wendriver API】之操作警告和弹出框
参考文章: <Python+Selenium笔记(九):操作警告和弹出框>
- android 三种弹出框之一PopupWindow
PopupWindow 在android的弹出框我目前了解到的是有三种:AlertDialog,PopupWindow,Activity伪弹框, AlertDialog太熟悉了,这里就不介绍了 就先看 ...
- Android 学习笔记之AndBase框架学习(二) 使用封装好的进度框,Toast框,弹出框,确认框...
PS:渐渐明白,在实验室呆三年都不如在企业呆一年... 学习内容: 1.使用AbActivity内部封装的方法实现进度框,Toast框,弹出框,确认框... AndBase中AbActivity封 ...
- 【Android】各式各样的弹出框与对菜单键、返回键的监听
Android自带各式各样的弹出框.弹出框也是安卓主要的组件之中的一个.同一时候安卓程序能够对菜单键.返回键的监听.但在安卓4.0之后就禁止对Home键的屏蔽与监听,强制保留为系统守护按键.假设非要对 ...
- [RN] React Native 封装选择弹出框(ios&android)
之前看到react-native-image-picker中自带了一个选择器,可以选择拍照还是图库,但我们的项目中有多处用到这个选择弹出框,所以就自己写了一下,最最重要的是ios和Android通用. ...
- Android 自定义界面的弹出框(可输入数据)
上午写了一篇博文,介绍了如何定义从屏幕底部弹出PopupWindow,写完之后,突然想起之前写过自定义内容显示的弹出框,就随手写了两个实例,分享出来: 第一种实现方式:继承Dialog 1.1 线定义 ...
- 关于Android 打开新的Activity 虚拟键盘的弹出与不弹出
关于Android 打开新的Activity 虚拟键盘的弹出与不弹出 打开Activity 时 在相应的情况 弹出虚拟键盘 或者 隐藏虚拟键盘 会给用户非常好的用户体验 , 实现起来也比较简单 只需 ...
- android 自定义弹出框AlertDialog ,很炫的哦
于是就小小的模仿了下自己写了这个这样的效果,主要代码如下:dlg = new AlertDialog.Builder(context).create();dlg.show();dlg.getWin ...
随机推荐
- A Kill Cord for your Laptop
前言 昨晚在朋友圈看到国外一篇文章利用U盘锁笔记本电脑,刚好有一个坏的金士顿U盘,所以就折腾了一下. 准备 USB设备*1 Arch系统*1 走过的坑 因为systemd-udevd带起来的进程是ro ...
- Java判断对象是否为Null/空
package com.taiping.test; import java.lang.reflect.Field; import java.lang.reflect.Type; /** * <p ...
- mysql 默认信息
泰基MYSQL默认信息 登录名1-------默认用户 名字:root 密码:123 登录名2-------APP对应的数据库 名字:hotekey 密码:8888
- SVN中如何创建共享文件夹
http://wenku.baidu.com/link?url=E8tC1idSdTABc3JzyqGYF8OXakDTIF_yWp8BvFqSX5dgcpkbm8Z57ursZtLpjmQAEABM ...
- PhpStorm For Mac 安装使用及 Php 开发的 ‘Hello World’
PHP全称为:Hypertext Preprocessor,中文名为:『超文本预处理 器』是一种通用开源脚本语言,主要用于Web应用开发(俗称做网站或 者做后台!) 编译软件:PHPStorm for ...
- Codeforces1140D. Minimum Triangulation
题目链接 本题是区间dp里的三角剖分,板子题,dp[i][j]表示凸多边形i-j构成的最值,转移方程为dp[i][j] = min/max(dp[i][k]+dp[k][j]+w[i,j,k])(i& ...
- Caffe2 载入预训练模型(Loading Pre-Trained Models)[7]
这一节我们主要讲述如何使用预训练模型.Ipython notebook链接在这里. 模型下载 你可以去Model Zoo下载预训练好的模型,或者使用Caffe2的models.download模块获取 ...
- [蓝桥杯2016初赛]卡片换位 BFS
题目描述 你玩过华容道的游戏吗?这是个类似的,但更简单的游戏.看下面 3 x 2 的格子 +---+---+---+ | A | * | * | +---+---+---+ | B | | * | + ...
- Java基础 -5.3
方法的递归调用 指的是一个方法自己调用自己的情况,利用递归调用可以解决一些重复且麻烦的问题 在进行我们递归调用的时候一般要考虑如下几点问题 一定要设置方法递归调用的结束条件 每一次调用的过程之中一定要 ...
- 南京江行智能获得百度和松禾资本的A+轮融资
导读 据公司情报专家<财经涂鸦>消息,南京江行联加智能科技有限公司(江行智能)获得百度 和松禾资本的A+ 轮融资. 天眼查信息显示,12 月 8 日,公司工商信息发生变更,股东新增了广州百 ...