Android GridView onclick未响应EditText
我想要一个带有图像和编辑文本的Android GridView onclick未响应EditText,android,gridview,Android,Gridview,我想要一个带有图像和编辑文本的Gridview。我想在单击时全屏显示图像,并在长时间单击时选择要删除的Gridview项目。但是Gridview事件OnItemLongClickListener()和OnItemClickListener()不响应EditText,尽管它们在EditTextandroid:focusable=“false”时工作已设置。我尝试过许多不同的解决方案,但没有一个有效。这是我的密码: activity_main.xml <LinearLayout xmlns
Gridview
。我想在单击时全屏显示图像,并在长时间单击时选择要删除的Gridview
项目。但是Gridview
事件OnItemLongClickListener()
和OnItemClickListener()
不响应EditText
,尽管它们在EditText
android:focusable=“false”时工作已设置。我尝试过许多不同的解决方案,但没有一个有效。这是我的密码:
activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<GridView
android:numColumns="2"
android:gravity="center"
android:columnWidth="100dp"
android:stretchMode="columnWidth"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/grid"
/>
</LinearLayout>
任何帮助都将不胜感激。。提前感谢。尝试在您的
编辑文本中添加这些行。
android:focusable="false"
android:focusableInTouchMode="false"
尝试在
EditText
android:focusable="false"
android:focusableInTouchMode="false"
终于解决了问题。 我使用了手势监听器并检测到了动作。
谢谢。终于解决了问题。 我使用了手势监听器并检测到了动作。
谢谢。我尝试过使用此选项,但我希望编辑文本可编辑。您能建议其他选项吗?编辑文本可编辑,但焦点不包含允许访问onItemClick的焦点。我尝试过使用此选项,但我希望编辑文本可编辑。您能建议其他选项吗?编辑文本可编辑,但焦点不包含“编辑文本集”是什么意思?“编辑文本集”是什么意思?
//import not included
public class CustomGrid extends BaseAdapter{
private Context mContext;
private final String[] web;
private final int[] Imageid;
public CustomGrid(Context c,String[] web,int[] Imageid ) {
mContext = c;
this.Imageid = Imageid;
this.web = web;
}
@Override
public int getCount() {
// TODO Auto-generated method stub
return web.length;
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return null;
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
View grid;
LayoutInflater inflater = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (convertView == null) {
grid = new View(mContext);
grid = inflater.inflate(R.layout.grid_single, null);
EditText textView = (EditText) grid.findViewById(R.id.grid_text);
ImageView imageView = (ImageView)grid.findViewById(R.id.grid_image);
// Button b1=(Button)grid.findViewById(R.id.button1);
textView.setText(web[position]);
imageView.setImageResource(Imageid[position]);
} else {
grid = (View) convertView;
}
return grid;
}
}
android:focusable="false"
android:focusableInTouchMode="false"