Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I managed to add footer to my gridview with a little trick. Lets say your adapters main data is List of MyDataInfo objects list, now when you passed all the data to adapter you can add two empty(<strong>null</strong>) objects and check in getView whether data is null or not and inflate desired view .</p> <pre><code>// in the adapter public void addVoid(YourInfo info) { dataList.add(info); dataList.add(info); notifyDataSetChanged(); } public View getView(int position, View convertView, ViewGroup parent) { if (dataList.get(position) !=null) { View vi = convertView; ViewHolder holder; if (convertView == null || convertView.getTag().equals("stop")) { //inflate your gridview item } else { holder = (ViewHolder) vi.getTag(); } // provide data to views return vi; } else { View v; if (position == dataList.size() - 2) { v = inflater.inflate(R.layout.show_more, null); // load more view v.setTag("stop"); } else { v = inflater.inflate(R.layout.progress_bar, null); // progress bar v.setTag("stop"); } return v; } </code></pre> <p>}</p> <p>Before this in your main activity where you set adapter you'll have something like this</p> <pre><code>YourAdapter adap = new YourAdapter(this, dataList); gridView.setAdapter(adap); YourInfo info = null; adapter.addVoid(info); </code></pre> <p>And important thing you'll have to handle onitemclick </p> <pre><code>int size = adapter.getCount(); public void onItemClick(AdapterView&lt;?&gt; parent,View view, int position, long id) { if (position == size - 2) { // user selected SHOW MORE view int wantedPosition = size - 1; int firstPosition = grid.getFirstVisiblePosition(); int wantedChild = wantedPosition- firstPosition; ProgressBar progBar = grid.getChildAt(wantedChild); progBar.setVisibility(View.Visible); return; } if (position == size - 1) // user selected progress bar return; } </code></pre> <p>Hope this helps ^^</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload