全屏提示框:
Dialog dialog = new Dialog(this, android.R.style.Theme_Holo_NoActionBar_Fullscreen);//全屏的Dialog
View view = LayoutInflater.from(this).inflate(R.layout.video_play_window, null);
dialog.setContentView(view);
确认提示框:
AlertDialog.Builder dialog = new AlertDialog.Builder(this);
dialog.setTitle(mDialogTexts[0]);
dialog.setMessage(stringRes);
dialog.setPositiveButton(mDialogTexts[2], null).setNegativeButton(mDialogTexts[1],
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
deleteMsg(msgInfo);
dialog.dismiss();
}
});
dialog.create().show();
PopupWindow:
View v = View.inflate(this, R.layout.photo_activity, null);
mPhotoWindow = new PopupWindow(v, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
//去除默认选中背景
mPhotoWindow.setBackgroundDrawable(new ColorDrawable());
mPhotoWindow.setFocusable(true);
//外边点击事件是否响应
mPhotoWindow.setOutsideTouchable(true);
mPhoto = (ImageView) v.findViewById(R.id.photo);
mPhoto.setImageBitmap(BitmapFactory.decodeFile(path));
//显示的位置
mPhotoWindow.showAtLocation(mFriendsCircleView, Gravity.CENTER, 0, 0);
RecyclerView:
//设置固定大小,减少资源消耗,避免重新测量
mRvFriendsCircleView.setHasFixedSize(true);
//创建一个管理器,可以跳到指定位置等一些操作
mLlManager = new LinearLayoutManager(this);
//当做增强版的ListView来使用
mLlManager.setOrientation(LinearLayout.VERTICAL);
mRvFriendsCircleView.setLayoutManager(mLlManager);
//添加Item分割线,默认灰色
final DividerItemDecoration divider =
new DividerItemDecoration(this, DividerItemDecoration.VERTICAL);
//修改分割线颜色
divider.setDrawable(getDrawable(R.drawable.item_divider_color));
//Item内容未能填充满
LayoutInflater.from(parent.getContext()).inflate(R.layout.xxx, parent,false);
EditText:
android:digits = "1234567890" //限制输入类型,除了数字其他文本类型无效
android:imeOptions="actionNext"//回车键功能,如下一个或搜索
android:textCursorDrawable="@null"//光标颜色
android:textColorHint="@android:color/white"//提示文本颜色