<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() {
@Override
public boolean onTouch(View v, MotionEvent event) {
return MotionEvent.ACTION_MOVE == event.getAction() ? true
: false;
}
});
GridView跳转
new_prize_grid
.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public 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);
}
});