GridView大全

来源:互联网 发布:网络安全工程师 编辑:程序博客网 时间:2024/05/22 08:09
<GridView                    android:id="@+id/new_prize_grid"                    android:layout_width="fill_parent"                    android:layout_height="wrap_content"                    android:layout_marginLeft="5dp"                    android:layout_marginRight="5dp"                    android:background="#00000000"                    android:horizontalSpacing="1dip"                    android:numColumns="4"                    android:padding="1dip"                    android:scrollbars="none"                    android:stretchMode="columnWidth"                    android:verticalSpacing="1dip" >                </GridView>


禁止GridView滚动new_prize_grid.setOnTouchListener(new AdapterView.OnTouchListener() {@Overridepublic boolean onTouch(View v, MotionEvent event) {return MotionEvent.ACTION_MOVE == event.getAction() ? true: false;}});

GridView跳转new_prize_grid.setOnItemClickListener(new AdapterView.OnItemClickListener() {@Overridepublic void onItemClick(AdapterView<?> parent, View view,int position, long id) {prize = (Prize) parent.getItemAtPosition(position);intent = new Intent();Bundle bundle = new Bundle();bundle.putString("tx_prizeIntroduction_name",prize.getName());bundle.putString("tx_prizeIntroduction_provider",prize.getReservation());bundle.putString("tx_prizeIntroduction_intro",prize.getContent());bundle.putString("tx_prizeIntroduction_photoUrl",prize.getPhotoUrl());intent.putExtras(bundle);intent.setClass(MainActivity.this,PrizeIntroductionActivity.class);startActivity(intent);}});





0 0