首页 > 作文

类似qq登录多账号保存

更新时间:2023-04-04 02:30:09 阅读: 评论:0

@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
while(!flag){
initWedget();
flag = true;
}
}

//初始化界面控件
private void initWedget(){
//初始化Handler,用来处理消息
handler = new Handler(LoginActivity.this);
//获取下拉框依附的组件宽度
int width = etPhone.getWidth();
pwidth = width;
//设置点击下拉箭头图片事件,点击弹出PopupWindow浮动下拉框
downimage.tOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(flag){
//显示PopupWindow窗口
popupWindwShowing();
}
}
});
//初始化PopupWindow
initPopuWindow();
}

//初始化填充Adapter所用List数据
private void initDatas(){
//查询myQLite中存进的数据
MySQLiteHelper mySQLiteHelper = new MySQLiteHelper(mActivityContext,“ur”,null,2);
HelperUrdao helperUrdao = new HelperUrdao(mActivityContext,mySQLiteHelper);
urList = heap天赋lperUrdao.query();
}

///初始化PopupWindow
private void initPopuWindow(){
initDatas();
//PopupWindow浮动下拉框布局 ,ListView
View loginwindow = (View)this.getLayoutInflater().inflate(R.layout.dialog_loginur, null);
listView = (ListView) loginwindow.findViewById(R.id.li_longur_list);

//设置自定义Adapter
optionsAdapter = new OptionsAdapter(this, handler,urList);
listView.tAdapter(optionsAdapter);

lectPopupWindow = new PopupWindow(l本人简历oginwindow, pwidth, LinearLayout.LayoutParams.WRAP_CONTENT, true);
lectPopupWindow.tOutsideTouchable(true);
//这一句是为了实现弹出PopupWindow后,当点击屏幕其他部分及Back键时PopupWindow会消失,
//没有这一句则效果不能出来,但并不会影响背景
lectPopupWindow.tBackgrou死在江南烟雨中ndDrawable(new BitmapDrawable());
}

//显示PopupWindow窗口
public void popupWindwShowing() {
//保证有数据才能显示 PopupWindow窗口,没数据的情况下,可能会窗口打开没法触发关闭,导致某些功能失效
if (urList != null && urList.size() != 0){
lectPopupWindow.showAsDropDown(etPhone,0,-3);
}
}

//PopupWindow消失
public void dismiss(){
lectPopupWindow.dismiss();
}

//处理Hander消息
@Override
public boolean handleMessage(Message message) {
Bundle data = message.getData();
switch(message.what){
ca 1:
//选中下拉项,下拉框消失
String number = data.getString(“number”);
String password = data.getString(“password”);
etPassword.tText(“”);
etPhone.tText(number);
etPassword.tText(password);
//隐藏密码
北京人民警察学院etPassword.tTransformationMethod(PasswordTransformationMethod.getInstance());

lipassword.tVisibility(View.VISIBLE);
//显示验证码登录选项
txtmim.tVisibility(View.VISIBLE);
//隐藏
limim.tVisibility(View.GONE);
txtpassword.tVisibility(View.GONE);
dismiss();
break;
ca 2://移除下拉项数据
//获取数据
String numbers = data.getString(“number”);
int delIndex = data.getInt(“delIndex”);
urList.remove(delIndex);
//删除数据
MySQLiteHelper mySQLiteHelper = new MySQLiteHelper(mActivityContext,“ur”,null,2);
HelperUrdao helperUrdao = new HelperUrdao(mActivityContext,mySQLiteHelper);
//判断文本框中的手机号等于的将被删除手机号就清空文本框
if (etPhone.getText().toString().equals(numbers)){
etPhone.tText(“”);
etPassword.tText(“”);
}
//执行删除
helperUrdao.delect(numbers);
//刷新下拉列表
optionsAdapter.notifyDataSetChanged();
//数据条数中国乒乓球队为0的时候关闭PopupWindow窗口,避免输入框点击不开
if (urList.size() == 0){
dismiss();
}
break;
}
return fal;
}
效果图

本文地址:https://blog.csdn.net/weixin_42601615/article/details/107866182

本文发布于:2023-04-04 02:30:07,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/zuowen/3865c96f2e89d9a0f7f58bd4978b0a94.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

本文word下载地址:类似qq登录多账号保存.doc

本文 PDF 下载地址:类似qq登录多账号保存.pdf

标签:数据   初始化   窗口   这一
相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图