我有一个问题,十二号之前的所有项目都可以,但是当我点击该项目时,从十二点开始,下一个项目返回打开新活动,但是在其他位置,我的意思是当我点击项目编号时十二,给我三号值。
这是我的代码
public void onItemClick(AdapterView<?> arg0, View arg1, int position,
long arg3) {
// TODO Auto-generated method stub
objAllBean=arrayOfLatestVideo.get(position);
int pos=objAllBean.getId();
Intent intplay=new Intent(getActivity(),VideoPlay.class);
intplay.putExtra("POSITION", pos);
intplay.putExtra("VIDEO_ID", allArrayVideo);
intplay.putExtra("VIDEO_CATNAME", allArrayVideoCatName);
intplay.putExtra("VIDEO_CATID", allArrayVideoCatId);
intplay.putExtra("VIDEO_URL", allArrayVideourl);
intplay.putExtra("VIDEO_NAME", allArrayVideoName);
intplay.putExtra("VIDEO_CID", allArrayVideoId);
intplay.putExtra("VIDEO_DURATION", allArrayVideoDuration);
intplay.putExtra("VIDEO_DISCRIPTION", allArrayVideoDesc);
intplay.putExtra("VIDEO_IMAGE_URL",allArrayImageUrl);
startActivity(intplay);
}
布局网格
<FrameLayout 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"
android:background="@drawable/gradient"
android:gravity="center"
android:id="@+id/rootlayout"
android:orientation="vertical" >
<GridView
android:id="@+id/lsv_latest"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numColumns="@integer/columns" <-- 3
android:verticalSpacing="0dp"
android:horizontalSpacing="0dp"
android:clickable="true"
android:stretchMode="columnWidth">
</GridView>
</FrameLayout>
item gridview
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gradient"
android:paddingTop="5dp"
android:paddingRight="3dp">
<ImageView
android:id="@+id/picture"
android:src="@drawable/ic_launcher"
android:contentDescription="@string/desc"
android:layout_width="match_parent"
android:layout_height="170dp"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginLeft="5dp">
<TextView
android:id="@+id/text_category"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="#ffffff"
android:background="#009ACC"
android:padding="2dp"
android:layout_marginTop="4dp"
android:textSize="10dp"
/>
<TextView
android:id="@+id/second"
android:text=""
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:textSize="1dp"
/>
<TextView
android:id="@+id/text"
android:text="HD"
android:layout_width="wrap_content"
android:layout_gravity="bottom"
android:layout_marginTop="120dp"
android:background="#9a000000"
android:layout_height="22dp"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@android:color/white"
/>
</LinearLayout>
</FrameLayout>