聚焦到EditText上不起作用 [英] Focus to the EditText doesn't work
问题描述
我用广播接收器来显示dialog.So code的流程是这样的:
第一步获取请求code值
第二步:在此基础上要求code中的广播接收器进入if或else if或else部分
第三步如果不匹配它显示了一个面包,我进入使用一些扫描仪进入的EditText(即扫描)值项目不可用。
第四步一旦项目不可用敬酒来了,我需要的重点是对的EditText(即扫描),以便下一次还我可以清除后放入新鲜的价值。
所以我的问题是我怎样才能提供焦点的EditText,并将其设置为EditText上(即扫描)。
有关参考,我附上与code片段捕捉和layout.xml.Please看看拖放您的建议,为什么重点是要列表视图。
的.java段
最后的BroadcastReceiver mBroadcastReceiver =新的广播接收器(){
@覆盖
公共无效的onReceive(上下文的背景下,意图意图){
如果(意向!= NULL){
LOC = mspinner.getItemAtPosition(mspinner.getSelectedItemPosition())
的ToString(); 最后弦乐货号;
最后弦乐说明;
最后弦乐StockUnit; 最后弦乐PickSeq; 最后弦乐qtyCount;
最后弦乐qtyonHand;
最后莫按钮;
最终按钮mcancel;
最终按钮mplus;
最终按钮mminus;
最终的EditText medtQtyCount;
最终的EditText medtItem;
最终的EditText medtdesc;
最终的EditText medtuom;
最终的数据库处理器dbHandler;
最终的String []计量单位= NULL;
INT申请code; LayoutInflater李= LayoutInflater.from(InventoryCount.this);
查看promptsView = li.inflate(R.layout.quantityupdate,NULL); AlertDialog.Builder alertDialogBuilder =新AlertDialog.Builder(
InventoryCount.this);
alertDialogBuilder.setView(promptsView); //request$c$c=Integer.parseInt(intent.getStringExtra(\"idx));
要求code = intent.getIntExtra(IDX,-1);
//创建警报对话框
最终AlertDialog alertDialog = alertDialogBuilder.create(); dbHandler =新数据库处理器(InventoryCount.this);
medtuom =(EditText上)promptsView.findViewById(R.id.edt_mseshipuom_mic);
莫=(按钮)promptsView.findViewById(R.id.btn_mseshipOk_mic);
mcancel =(按钮)promptsView.findViewById(R.id.btn_mseshipCancel_mic);
mplus =(按钮)promptsView.findViewById(R.id.btn_mseshipIncr_mic);
mminus =(按钮)promptsView.findViewById(R.id.btn_mseshipDecr_mic);
medtQtyCount =(EditText上)promptsView
.findViewById(R.id.edt_shipShiped_mic);
medtdesc =(EditText上)promptsView
.findViewById(R.id.edt_mseshipQtyOrd_mic);
medtItem =(EditText上)promptsView
.findViewById(R.id.edt_mseshipItemNo_mic); 如果(要求code == 1){
}
否则,如果(要求code == 0){
// 编号
/ *如果(结果code == RESULT_OK){
Log.i(扫描resul格式:
intent.getStringExtra(SCAN_RESULT_FORMAT));
* /
串伊特诺= intent.getStringExtra(SCAN_RESULT); dbhelper.getReadableDatabase();
MIC_Inventory mic_inventory = dbhelper.getMicInventoryDetails(
LOC,伊特诺);
dbhelper.closeDatabase(); 如果(mic_inventory!= NULL){ LOC = mspinner.getItemAtPosition(
mspinner.getSelectedItemPosition())的toString(); 货号= mic_inventory.getItemno();
说明= mic_inventory.getItemdescription();
PickSeq = mic_inventory.getPickingseq();
StockUnit = mic_inventory.getStockunit();
qtyonHand = mic_inventory.getQoh(); //这个值给出
// QOHand
qtyCount = mic_inventory.getQc(); medtItem.setText(货号);
medtdesc.setText(说明);
medtQtyCount.setText(qtyCount);
medtuom.setText(StockUnit); mplus.setOnClickListener(新OnClickListener(){ @覆盖
公共无效的onClick(查看为arg0){
// TODO自动生成方法存根
字符串= medtQtyCount.getText()的toString()。
INT B =的Integer.parseInt(一);
B = B + 1;
一个= a.valueOf(二);
medtQtyCount.setText(一);
}
});
mminus.setOnClickListener(新OnClickListener(){ @覆盖
公共无效的onClick(视图v){
// TODO自动生成方法存根
INT C =的Integer.parseInt(medtQtyCount.getText()
的ToString());
C = C - 1;
medtQtyCount.setText(新整型(三)的ToString());
}
});
mok.setOnClickListener(新OnClickListener(){ @覆盖
公共无效的onClick(视图v){
// TODO自动生成方法存根
/ *
* UOM [mspinnerUom.getSelectedItemPosition()] =
* medtQtyCount .getText()的toString()。
* /
MIC_UOMInternal mic_uom =新MIC_UOMInternal();
mic_uom.setLocation(LOC);
mic_uom.setItemno(货号);
字符串updatedqtyCount = medtQtyCount.getText()
的ToString(); 如果(!qtyCount.equals(updatedqtyCount)){
mic_uom.setQc(双人间
.parseDouble(updatedqtyCount));
mic_uom.setUom(StockUnit); MIC_Inventory mic_Inventory =新MIC_Inventory();
mic_Inventory.setItemdescription(说明);
mic_Inventory.setItemno(货号);
mic_Inventory.setLocation(LOC);
mic_Inventory.setPickingseq(PickSeq);
mic_Inventory.setQc(updatedqtyCount);
mic_Inventory.setQoh(qtyonHand);
mic_Inventory.setStockunit(StockUnit); dbHandler.getWritableDatabase();
字符串结果= dbHandler
.insertIntoInternal(mic_uom);
如果(result.equals(成功)){
结果= dbHandler.updateMIC(mic_Inventory);
}
dbHandler.closeDatabase();
}
意图I =新意图(InventoryCount.this,
InventoryCount.class);
i.putExtra(等,1);
i.putExtra(所在地,LOC);
// i.putExtra(ID,ID);
startActivity(ⅰ);
// InventoryCount.this.finish(); }
});
mcancel.setOnClickListener(新OnClickListener(){ @覆盖
公共无效的onClick(视图v){
// TODO自动生成方法存根
alertDialog.cancel(); }
}); // 展示下
alertDialog.show(); }其他{
/ *
* Toast.makeText(这一点,项目不可用,
* Toast.LENGTH_LONG).show();
* /
toastText.setText(项目不可用);
吐司面包=新吐司(getBaseContext());
toast.setGravity(Gravity.CENTER_VERTICAL,0,410);
toast.setDuration(Toast.LENGTH_SHORT);
toast.setView(toastLayout);
toast.show();
lstView.setFocusable(假); msearchtext.requestFocus();
/ * InputMethodManager IMM =(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(msearchtext,InputMethodManager.SHOW_IMPLICIT); * /
msearchtext.setText(); }
否则,如果(要求code == 2){
}
其他
{
toastText.setText(问题在扫描);
吐司面包=新吐司(getApplicationContext());
toast.setGravity(Gravity.CENTER_VERTICAL,0,410);
toast.setDuration(Toast.LENGTH_SHORT);
toast.setView(toastLayout);
toast.show();
}
}
Layout.xml
<?XML版本=1.0编码=UTF-8&GT?;
<的RelativeLayout的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =match_parent
机器人:layout_height =match_parent
机器人:背景=@绘制/ border_green
机器人:descendantFocusability =beforeDescendants
机器人:focusableInTouchMode =真
机器人:方向=垂直
机器人:paddingBottom会=@扪/ activity_vertical_margin
机器人:paddingLeft =@扪/ activity_horizontal_margin
机器人:paddingRight =@扪/ activity_horizontal_margin
机器人:paddingTop =@扪/ activity_vertical_margin> <的TextView
机器人:ID =@ + ID / txt_InvTitle
风格=@风格/ PAGETITLE
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_alignParentTop =真
机器人:layout_centerHorizontal =真
机器人:layout_marginTop =5DP
机器人:文字=@字符串/ invTitle/> <查看
机器人:ID =@ + ID / txt_InvView
机器人:layout_width =match_parent
机器人:layout_height =2DIP
机器人:layout_below =@ + ID / txt_InvTitle
机器人:layout_marginLeft =10dp
机器人:layout_marginRight =10dp
机器人:背景=#2E9AFE/> <的LinearLayout
机器人:ID =@ + ID / invLocation
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:方向=横向
机器人:layout_below =@ + ID / txt_InvView
机器人:layout_marginTop =16DP> <的TextView
机器人:ID =@ + ID / txtLoc
风格=@风格/ textRegular
机器人:layout_width =match_parent
机器人:layout_height =match_parent
机器人:layout_weight =1
机器人:重力=左|中心
机器人:文字=@字符串/位置/> <微调
机器人:ID =@ + ID / sploc
风格=@风格/ SpinnerItemAppTheme
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:layout_weight =5
机器人:编辑=假/>
< / LinearLayout中>
<的LinearLayout
机器人:ID =@ + ID / invScanType
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:layout_below =@ ID / invLocation
机器人:layout_gravity =中心
机器人:layout_marginBottom =3DP
机器人:layout_marginLeft =3DP
机器人:layout_marginTop =18dp
机器人:方向=横向> <的EditText
机器人:ID =@ + ID / edt_Search_mic
风格=@风格/ EditTextAppTheme_Scan
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:layout_marginLeft =3DP
机器人:layout_weight =15
机器人:比重=中心
机器人:提示=@字符串/扫描/>
< RadioGroup中
机器人:ID =@ + ID / radioScanBasedOn_mic
风格=@风格/ RadioButtonAppTheme
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:方向=横向> <单选
机器人:ID =@ + ID / radioInum_mic
风格=@风格/ textRegular
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_weight =25
机器人:按钮=@绘制/ radiobutton_selector
安卓:检查=真
机器人:drawablePadding =50dp
机器人:paddingLeft =10dip
机器人:文字=@字符串/货号/> <单选
机器人:ID =@ + ID / radioNum_mic
风格=@风格/ textRegular
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_marginLeft =5DP
机器人:按钮=@绘制/ radiobutton_selector
安卓:检查=假
机器人:layout_marginRight =5DP
机器人:layout_weight =25
机器人:drawablePadding =50dp
机器人:paddingLeft =10dip
机器人:文字=@字符串/ manfno/> <单选
机器人:ID =@ + ID / radioUpc_mic
风格=@风格/ textRegular
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_marginLeft =5DP
机器人:按钮=@绘制/ radiobutton_selector
安卓:检查=假
机器人:layout_marginRight =5DP
机器人:layout_weight =25
机器人:drawablePadding =50dp
机器人:paddingLeft =10dip
机器人:文字=@字符串/ UPC/>
< / RadioGroup中>
< / LinearLayout中> < HorizontalScrollView
机器人:ID =@ + ID / scroll_full_mic
机器人:layout_width =match_parent
机器人:layout_height =match_parent
机器人:layout_below =@ + ID / invScanType> <的LinearLayout
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =FILL_PARENT
机器人:layout_marginTop =25dp
机器人:方向=垂直> <的LinearLayout
机器人:ID =@ + ID / lay_fullTitle_mic
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:背景=#000000
机器人:方向=横向
机器人:填充=5DP> <的TextView
风格=@风格/ textRegular_list
机器人:layout_width =105dp
机器人:layout_height =WRAP_CONTENT
机器人:文字=@字符串/货号
机器人:textAppearance =机器人:ATTR / textAppearanceSmall
机器人:文字样式=大胆/> <的TextView
风格=@风格/ textRegular_list
机器人:layout_width =130dp
机器人:layout_height =WRAP_CONTENT
机器人:比重=中心|左
机器人:文字=@字符串/描述
机器人:textAppearance =机器人:ATTR / textAppearanceSmall
机器人:文字样式=大胆/> <的TextView
风格=@风格/ textRegular_list
机器人:layout_width =140dp
机器人:layout_height =WRAP_CONTENT
机器人:layout_marginLeft =4DP
机器人:比重=中心|左
机器人:文字=@字符串/ pick_seq
机器人:textAppearance =机器人:ATTR / textAppearanceSmall
机器人:文字样式=大胆/> <的TextView
风格=@风格/ textRegular_list
机器人:layout_width =120dp
机器人:layout_height =WRAP_CONTENT
机器人:layout_marginLeft =4DP
机器人:比重=中心|左
机器人:文字=@字符串/库存量
机器人:textAppearance =机器人:ATTR / textAppearanceSmall
机器人:文字样式=大胆/> <的TextView
风格=@风格/ textRegular_list
机器人:layout_width =120dp
机器人:layout_height =WRAP_CONTENT
机器人:layout_marginLeft =4DP
机器人:比重=中心|左
机器人:文字=@字符串/ QC
机器人:textAppearance =机器人:ATTR / textAppearanceSmall
机器人:文字样式=大胆/> <的TextView
风格=@风格/ textRegular_list
机器人:layout_width =100dp
机器人:layout_height =WRAP_CONTENT
机器人:layout_marginLeft =4DP
机器人:比重=中心|左
机器人:文字=@字符串/计量单位
机器人:textAppearance =机器人:ATTR / textAppearanceSmall
机器人:文字样式=大胆/>
< / LinearLayout中> < ListView控件
机器人:ID =@ + ID / lst_msefull_mic
机器人:layout_width =match_parent
机器人:layout_height =match_parent 风格=@风格/ ListViewAppTheme.White>
< /&的ListView GT;
< / LinearLayout中>
< / HorizontalScrollView> <的LinearLayout
机器人:ID =@ + ID / lay_PO_mic
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_alignParentBottom =真
机器人:layout_alignParentLeft =真
机器人:layout_marginBottom =41dp
机器人:重力=CENTER_HORIZONTAL
机器人:方向=横向
机器人:知名度=水涨船高> <按钮
机器人:ID =@ + ID / btn_OrderLstImport_mic
机器人:layout_width =100dp
机器人:layout_height =100dp
机器人:TEXTSIZE =18dp
机器人:文字样式=大胆/> <按钮
机器人:ID =@ + ID / btn_OrderLstExport_mic
机器人:layout_width =100dp
机器人:layout_height =100dp
机器人:TEXTSIZE =18dp
机器人:文字样式=大胆/> <按钮
机器人:ID =@ + ID / btn_OrderLstExit_mic
机器人:layout_width =100dp
机器人:layout_height =100dp
机器人:TEXTSIZE =18dp
机器人:文字样式=大胆/>
< / LinearLayout中>< / RelativeLayout的>
这个是什么:
lstView.post(新的Runnable(){
@覆盖
公共无效的run(){
msearchtext.requestFocus();
}
});
I'm using broadcast receiver to show a dialog.So the flow of code is something like:
Step1 Getting the requestCode value
Step2 Based on this requestCode the broadCast receiver goes to if or else if or else part
Step3 If the value that i entered using some scanner into the EditText(i.e Scan) doesn't matches it shows a Toast "Item Not Available".
Step 4 Once "Item Not Available" toast comes I need the focus to be on EditText(i.e Scan) so that next time also i can put fresh value in that after clearing it.
So my question is "How can i give focus to the EditText" and set it to the EditText(i.e Scan).
For Reference I'm attaching the snap with code snippet and the layout.xml.Please have a look and drop your suggestions why the focus is going to the listview.
.java snippet
final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (intent != null) {
loc = mspinner.getItemAtPosition(mspinner.getSelectedItemPosition())
.toString();
final String ItemNo;
final String Desc;
final String StockUnit;
final String PickSeq;
final String qtyCount;
final String qtyonHand;
final Button mok;
final Button mcancel;
final Button mplus;
final Button mminus;
final EditText medtQtyCount;
final EditText medtItem;
final EditText medtdesc;
final EditText medtuom;
final DatabaseHandler dbHandler;
final String[] UOM = null;
int requestCode;
LayoutInflater li = LayoutInflater.from(InventoryCount.this);
View promptsView = li.inflate(R.layout.quantityupdate, null);
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
InventoryCount.this);
alertDialogBuilder.setView(promptsView);
//requestCode=Integer.parseInt(intent.getStringExtra("idx"));
requestCode=intent.getIntExtra("idx", -1);
// create alert dialog
final AlertDialog alertDialog = alertDialogBuilder.create();
dbHandler = new DatabaseHandler(InventoryCount.this);
medtuom = (EditText) promptsView.findViewById(R.id.edt_mseshipuom_mic);
mok = (Button) promptsView.findViewById(R.id.btn_mseshipOk_mic);
mcancel = (Button) promptsView.findViewById(R.id.btn_mseshipCancel_mic);
mplus = (Button) promptsView.findViewById(R.id.btn_mseshipIncr_mic);
mminus = (Button) promptsView.findViewById(R.id.btn_mseshipDecr_mic);
medtQtyCount = (EditText) promptsView
.findViewById(R.id.edt_shipShiped_mic);
medtdesc = (EditText) promptsView
.findViewById(R.id.edt_mseshipQtyOrd_mic);
medtItem = (EditText) promptsView
.findViewById(R.id.edt_mseshipItemNo_mic);
if (requestCode == 1) {
}
else if (requestCode == 0) {
// ItemNo
/*if (resultCode == RESULT_OK) {
Log.i("Scan resul format: ",
intent.getStringExtra("SCAN_RESULT_FORMAT"));
*/
String itNo = intent.getStringExtra("SCAN_RESULT");
dbhelper.getReadableDatabase();
MIC_Inventory mic_inventory = dbhelper.getMicInventoryDetails(
loc, itNo);
dbhelper.closeDatabase();
if (mic_inventory != null) {
loc = mspinner.getItemAtPosition(
mspinner.getSelectedItemPosition()).toString();
ItemNo = mic_inventory.getItemno();
Desc = mic_inventory.getItemdescription();
PickSeq = mic_inventory.getPickingseq();
StockUnit = mic_inventory.getStockunit();
qtyonHand = mic_inventory.getQoh();// This value gives
// QOHand
qtyCount = mic_inventory.getQc();
medtItem.setText(ItemNo);
medtdesc.setText(Desc);
medtQtyCount.setText(qtyCount);
medtuom.setText(StockUnit);
mplus.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
String a = medtQtyCount.getText().toString();
int b = Integer.parseInt(a);
b = b + 1;
a = a.valueOf(b);
medtQtyCount.setText(a);
}
});
mminus.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
int c = Integer.parseInt(medtQtyCount.getText()
.toString());
c = c - 1;
medtQtyCount.setText(new Integer(c).toString());
}
});
mok.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
/*
* UOM[mspinnerUom.getSelectedItemPosition()] =
* medtQtyCount .getText().toString();
*/
MIC_UOMInternal mic_uom = new MIC_UOMInternal();
mic_uom.setLocation(loc);
mic_uom.setItemno(ItemNo);
String updatedqtyCount = medtQtyCount.getText()
.toString();
if (!qtyCount.equals(updatedqtyCount)) {
mic_uom.setQc(Double
.parseDouble(updatedqtyCount));
mic_uom.setUom(StockUnit);
MIC_Inventory mic_Inventory = new MIC_Inventory();
mic_Inventory.setItemdescription(Desc);
mic_Inventory.setItemno(ItemNo);
mic_Inventory.setLocation(loc);
mic_Inventory.setPickingseq(PickSeq);
mic_Inventory.setQc(updatedqtyCount);
mic_Inventory.setQoh(qtyonHand);
mic_Inventory.setStockunit(StockUnit);
dbHandler.getWritableDatabase();
String result = dbHandler
.insertIntoInternal(mic_uom);
if (result.equals("success")) {
result = dbHandler.updateMIC(mic_Inventory);
}
dbHandler.closeDatabase();
}
Intent i = new Intent(InventoryCount.this,
InventoryCount.class);
i.putExtra("et", 1);
i.putExtra("LOCATION", loc);
// i.putExtra("ID", ID);
startActivity(i);
// InventoryCount.this.finish();
}
});
mcancel.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
alertDialog.cancel();
}
});
// show it
alertDialog.show();
} else {
/*
* Toast.makeText(this, "Item not available",
* Toast.LENGTH_LONG).show();
*/
toastText.setText("Item not available");
Toast toast = new Toast(getBaseContext());
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 410);
toast.setDuration(Toast.LENGTH_SHORT);
toast.setView(toastLayout);
toast.show();
lstView.setFocusable(false);
msearchtext.requestFocus();
/*InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(msearchtext, InputMethodManager.SHOW_IMPLICIT);*/
msearchtext.setText("");
}
else if (requestCode == 2) {
}
else
{
toastText.setText("Problem in Scanning");
Toast toast = new Toast(getApplicationContext());
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 410);
toast.setDuration(Toast.LENGTH_SHORT);
toast.setView(toastLayout);
toast.show();
}
}
Layout.xml
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/border_green"
android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin" >
<TextView
android:id="@+id/txt_InvTitle"
style="@style/pageTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:text="@string/invTitle" />
<View
android:id="@+id/txt_InvView"
android:layout_width="match_parent"
android:layout_height="2dip"
android:layout_below="@+id/txt_InvTitle"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#2E9AFE" />
<LinearLayout
android:id="@+id/invLocation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_below="@+id/txt_InvView"
android:layout_marginTop="16dp" >
<TextView
android:id="@+id/txtLoc"
style="@style/textRegular"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="left|center"
android:text="@string/location" />
<Spinner
android:id="@+id/sploc"
style="@style/SpinnerItemAppTheme"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight=".5"
android:editable="false" />
</LinearLayout>
<LinearLayout
android:id="@+id/invScanType"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/invLocation"
android:layout_gravity="center"
android:layout_marginBottom="3dp"
android:layout_marginLeft="3dp"
android:layout_marginTop="18dp"
android:orientation="horizontal" >
<EditText
android:id="@+id/edt_Search_mic"
style="@style/EditTextAppTheme_Scan"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="3dp"
android:layout_weight=".15"
android:gravity="center"
android:hint="@string/scan" />
<RadioGroup
android:id="@+id/radioScanBasedOn_mic"
style="@style/RadioButtonAppTheme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<RadioButton
android:id="@+id/radioInum_mic"
style="@style/textRegular"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight=".25"
android:button="@drawable/radiobutton_selector"
android:checked="true"
android:drawablePadding="50dp"
android:paddingLeft="10dip"
android:text="@string/itemno" />
<RadioButton
android:id="@+id/radioNum_mic"
style="@style/textRegular"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:button="@drawable/radiobutton_selector"
android:checked="false"
android:layout_marginRight="5dp"
android:layout_weight=".25"
android:drawablePadding="50dp"
android:paddingLeft="10dip"
android:text="@string/manfno" />
<RadioButton
android:id="@+id/radioUpc_mic"
style="@style/textRegular"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:button="@drawable/radiobutton_selector"
android:checked="false"
android:layout_marginRight="5dp"
android:layout_weight=".25"
android:drawablePadding="50dp"
android:paddingLeft="10dip"
android:text="@string/upc" />
</RadioGroup>
</LinearLayout>
<HorizontalScrollView
android:id="@+id/scroll_full_mic"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/invScanType" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginTop="25dp"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/lay_fullTitle_mic"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#000000"
android:orientation="horizontal"
android:padding="5dp" >
<TextView
style="@style/textRegular_list"
android:layout_width="105dp"
android:layout_height="wrap_content"
android:text="@string/itemno"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textStyle="bold" />
<TextView
style="@style/textRegular_list"
android:layout_width="130dp"
android:layout_height="wrap_content"
android:gravity="center|left"
android:text="@string/description"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textStyle="bold" />
<TextView
style="@style/textRegular_list"
android:layout_width="140dp"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:gravity="center|left"
android:text="@string/pick_seq"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textStyle="bold" />
<TextView
style="@style/textRegular_list"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:gravity="center|left"
android:text="@string/qoh"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textStyle="bold" />
<TextView
style="@style/textRegular_list"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:gravity="center|left"
android:text="@string/qc"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textStyle="bold" />
<TextView
style="@style/textRegular_list"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_marginLeft="4dp"
android:gravity="center|left"
android:text="@string/uom"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textStyle="bold" />
</LinearLayout>
<ListView
android:id="@+id/lst_msefull_mic"
android:layout_width="match_parent"
android:layout_height="match_parent"
style="@style/ListViewAppTheme.White" >
</ListView>
</LinearLayout>
</HorizontalScrollView>
<LinearLayout
android:id="@+id/lay_PO_mic"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="41dp"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:visibility="gone" >
<Button
android:id="@+id/btn_OrderLstImport_mic"
android:layout_width="100dp"
android:layout_height="100dp"
android:textSize="18dp"
android:textStyle="bold" />
<Button
android:id="@+id/btn_OrderLstExport_mic"
android:layout_width="100dp"
android:layout_height="100dp"
android:textSize="18dp"
android:textStyle="bold" />
<Button
android:id="@+id/btn_OrderLstExit_mic"
android:layout_width="100dp"
android:layout_height="100dp"
android:textSize="18dp"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
What about this:
lstView.post(new Runnable() {
@Override
public void run() {
msearchtext.requestFocus();
}
});
这篇关于聚焦到EditText上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!