Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Very possible. You just have to think about what you want to do, where it applies, then add in the code to the appropriate areas.</p> <p>For example:</p> <p><strong>Step 1: Figure out / know how many columns</strong> Either get how many columns your <code>GridView</code> currently has at runtime by the appropriate member function call (<a href="http://developer.android.com/reference/android/widget/GridView.html#getNumColumns%28%29" rel="nofollow">GridView.getNumColumns</a> - note you must be >= API level 11 to use this call). Otherwise <a href="http://developer.android.com/reference/android/widget/GridView.html#setNumColumns%28int%29" rel="nofollow">GridView.setNumColumns</a> will need to be done in the setup. A last option is to figure out what the number of columns should be, and set this in <code>onMeasure</code> or similar <code>Overrides</code>. </p> <p><strong>Step 2: Write your getView code</strong> In your code for <code>getView</code> in the adapter you choose, you should be able to do simple math to figure out what to do. For example:</p> <pre><code>public View getView(int position, View convertView, ViewGroup parent) { // Either have numOfColumns saved as a global variable or get it here depending on your method // Create your view for the item View ret; if (position &lt; numOfColumns || position % numOfColumns == 0) { // Aka if first row OR if first column TextView tv = new TextView(mContext); // Do all your textview formatting etc etc.... ret = tv; } else { ImageView iv = new ImageView(mContext); // Do all your imageview layout stuff etc etc.... ret = iv; } return ret; } </code></pre> <p>Note: This is purely just your brainstorming / thinking out loud done for you to get you started. You are missing things like (a clever way to memory optimize for recycling views with different types of <code>Views</code> if your <code>GridView</code> will scroll). You could also consider creating a custom layout and just using that as your view and modifying it as necessary with the above selection code.</p> <p>So to answer your question, <strong>yes</strong> it is possible.</p>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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