Friday, March 7, 2014

Pit father GridView


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) {
HashMap map = 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 = "fill_parent"
android: layout_height = "wrap_content"
>


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:
references, 4th Floor lieri111 reply:
GridView and listview inside the Item Button can not have or do not respond to the click event, instead of using ImageView button
< / fieldset>
Thank you!
Reply:
reference to the third floor youngc527 reply:
GridView inside Item layout does not contain "focusable" part, try to remove the btn_pageturning

Thanks already get

No comments:

Post a Comment