点击listview的行有时显示这样,有时显示正常
,此现象只出现在三星N7100真机上,,,重写的Dialog不好适配啊,怎么办?
当我把屏幕先放横屏再放竖屏时,这个现象就就没有了,显示总是正常!
相关代码,如下所示.
public void updatePrice(final int arg2) {//当点击ListView上的每一行时弹出对话框来修改珠宝的零售价和调换价
LayoutInflater factory=LayoutInflater.from(Jjtz.this);
final View v1=factory.inflate(R.layout.jjtzdialog,null);
AlertDialog.Builder dialog=new AlertDialog.Builder(this);
final AlertDialog alertDialogs = dialog.create();
TextView dmtxt=(TextView) v1.findViewById(R.id.dm);//显示成色代码
TextView mctxt=(TextView) v1.findViewById(R.id.mc);//显示简称
dmtxt.setText("成色代码:"+arrayList.get(arg2).get("dm").toString());
mctxt.setText("简称:"+arrayList.get(arg2).get("mc").toString());
dialog.setTitle("修改金价");
dialog.setView(v1);
dialog.setPositiveButton("确定修改", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
try{ //修改金价
EditText lsj=(EditText) v1.findViewById(R.id.lsj);//输入零售价
EditText dhj=(EditText) v1.findViewById(R.id.dhj);//输入调换价
final String lsjStr = lsj.getText().toString().trim();
final String dhjStr = dhj.getText().toString().trim();
final String dm=arrayList.get(arg2).get("dm").toString();
new Thread(){
public void run() {
mHandler.sendEmptyMessage(CODE_HINT);
try{
if(lsjStr.length()!=0&&dhjStr.length()==0){
parser.xml2list("http://........./updateJjtzLsj?lsj="+lsjStr+"&dm="+dm+"",
"diffgr:diffgram", "");}
else if(lsjStr.length()==0&&dhjStr.length()!=0){
parser.xml2list("http://........./updateJjtzDhj?dhj="+dhjStr+"&dm="+dm+"",
"diffgr:diffgram", "");}
else if(lsjStr.length()!=0&&dhjStr.length()!=0){
parser.xml2list("http://........./updateJjtz?lsj="+lsjStr+"&dhj="+dhjStr+"&dm="+dm+"",
"diffgr:diffgram", "");}
}catch(Exception e){
e.printStackTrace();
}
SystemClock.setCurrentTimeMillis(2000);
List<String[]> list=getDataFromServer();
//System.out.println("new thread 插入后的list:"+list!=null);
if(list!=null){
mHandler.sendEmptyMessage(CODE_OK);
}
}
}.start();
}catch(Exception e){
e.printStackTrace();
}
}
});
dialog.setNegativeButton("取消修改",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
}
});
dialog.show();
}
觉得写得不错,帮忙打赏下,谢谢!