[問題] 在gridview 中使用arrayadapter無法捲動

看板AndroidDev作者 (大棵)時間10年前 (2015/07/17 16:39), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
目前的問題是gridview 2跟gridview3再捲到最下面時 無法再捲動 造成後面的資料無法顯示 一開始用的是cursoradapter時 可以捲動 有試過換成baseadapter 無效 不知是否有哪位大大 能給我點線索 謝謝 gridview 2 adapter程式碼如下: class myCursorsAdapter extends android.widget.ArrayAdapter { int reSource; Context context = null; private LayoutInflater mInflater; private ArrayList<Data> abc = null; public myCursorsAdapter(Context context, int textViewResourceId, ArrayList<Data> objects) { super(context, textViewResourceId, objects); // TODO Auto-generated constructor stub reSource = textViewResourceId; mInflater = (LayoutInflater) context.getSystemService(context.LAYOUT_INFLATER_SERVICE); abc = objects; } public View getView(int position, View convertView, ViewGroup parent) { View view; ViewHolder holder; if (convertView == null) { view = mInflater.inflate(reSource, parent, false); holder = new ViewHolder(); holder.nameView = (TextView) view.findViewById(R.id.Name); holder.phoneNum = (TextView) view.findViewById(R.id.Number); holder.logoView = (ImageView) view.findViewById(R.id.Logo); view.setTag(holder); } else { view = convertView; holder = (ViewHolder) convertView.getTag(); } ChannelData temp = abc.get(position); holder.nameView.setText(temp.getChannelName()); holder.phoneNum.setText(Integer.toString(temp.getChannelNum())); holder.logoView.setImageBitmap(temp.getChannelLogo()); Log.d("Theme", temp.toString()); return view; } @Override public int getCount() { return abc != null ? abc.size() : 0; } static class ViewHolder { TextView nameView; TextView phoneNum; ImageView logoView; } } xml如下: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/ChannelAppRootLayout" android:layout_width="1400dp" android:layout_height="match_parent" android:layout_marginLeft="0dp" android:clipChildren="false" android:clipToPadding="false" > <!-- The primary full-screen view. This can be replaced with whatever view is needed to present your content, e.g. VideoView, SurfaceView, TextureView, etc. --> <!-- This FrameLayout insets its children based on system windows using android:fitsSystemWindows. --> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <RelativeLayout android:id="@+id/relatvielayout1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/relatvielayout2" > <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" > <CheckedTextView android:id="@+id/checkedTextView1" android:layout_width="180dp" android:layout_height="30dp" android:focusable="true" android:checked="true" android:focusableInTouchMode="true" android:text="@string/app_name" android:textColor="@color/filterbar_text_selector" /> <CheckedTextView android:id="@+id/checkedTextView2" android:layout_width="180dp" android:layout_height="30dp" android:focusable="true" android:focusableInTouchMode="true" android:drawableLeft="@drawable/ic_add_circle_white_18dp" android:text="@string/app_name" android:textColor="@color/filterbar_text_selector" /> <GridView android:id="@+id/gridView" android:layout_width="wrap_content" android:layout_height="30dp" android:numColumns="7" /> </LinearLayout> </RelativeLayout> <RelativeLayout android:id="@+id/relatvielayout2" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/relatvielayout1" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <GridView android:id="@+id/gridView2" android:layout_width="180dp" android:layout_height="700dp" /> <GridView android:id="@+id/gridView3" android:layout_marginLeft="180dp" android:layout_width="wrap_content" android:layout_height="wrap_content" " /> </LinearLayout> </RelativeLayout> </LinearLayout> </RelativeLayout> -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 60.251.47.144 ※ 文章網址: https://www.ptt.cc/bbs/AndroidDev/M.1437122394.A.57A.html
文章代碼(AID): #1LgBzQLw (AndroidDev)