I've also used the project GridView, click the item has a reaction, so I do not know by now there is no response, the code is very simple, an activity, two xml files, as follows:
public class WeiWoDuZunDetailActivity extends Activity {
private String [] buttons = {"button1", "button2", "button3", "button4", "button5", "button6",
"Button7", "button8", "button9", "back", "button0", "next"};
@ Override
protected void onCreate (Bundle savedInstanceState) {
/ / TODO Auto-generated method stub
super.onCreate (savedInstanceState);
setContentView (R.layout.activity_weiwoduzundetail);
GridView gridView = (GridView) findViewById (R.id.gridview_weiwoduzun);
ArrayList> numList = new ArrayList > ();
for (String button: buttons) {
HashMapmap = new HashMap ();
map.put ("key", button);
numList.add (map);
}
SimpleAdapter adapter = new SimpleAdapter (this, numList, R.layout.item_weiwoduzundetail,
new String [] {"keyi"}, new int [] {R.id.btn_pageturning});
gridView.setAdapter (adapter);
gridView.setOnItemClickListener (new OnItemClickListener () {
@ Override
public void onItemClick (AdapterView arg0, View arg1, int arg2,
long arg3) {
/ / TODO Auto-generated method stub
Log.v ("test", "to the point of reaction ah");
}
});
}
}
android: layout_width = "match_parent"
android: layout_height = "match_parent"
android: orientation = "vertical">
android: layout_width = "wrap_content"
android: layout_height = "wrap_content"
android: id = "@ + id / btn_ok"
android: text = "OK" />android: id = "@ + id / gridview_weiwoduzun"
android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
android: columnWidth = "90dp"
android: gravity = "center"
android: numColumns = "auto_fit"
android: stretchMode = "columnWidth">
android: layout_width = "fill_parent"
android: layout_height = "wrap_content"
>
android: id = "@ + id / btn_pageturning"
android: layout_width = "70dip"
android: layout_height = "70dip"
android: layout_centerHorizontal = "true" />
I added in activity button, click responsive, but gridView is wood, seeking answers!<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
gridView.requestFoucse.
Reply:
Tried, wooden helpful, requestFoucse () returns false
Reply:
GridView inside Item layout does not contain "focusable" part, try to remove the btn_pageturning
Reply:
GridView and inside the listview Item Button can not have or do not respond to the click event, instead of button with ImageView
Reply:
No comments:
Post a Comment