Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<blockquote> <p>inside your listview</p> </blockquote> <pre><code>... &lt;ListView android:id="@+id/android:list" android:layout_width="fill_parent" android:layout_height="wrap_content" android:scrollingCache="true" android:divider="#000000" android:dividerHeight="1px" android:background="#FFFFFF" android:cacheColorHint="#FFFFFF" android:fastScrollEnabled="true" /&gt; ... </code></pre> <blockquote> <p>you will inflate diferent types of layouts, customizing sizes and colours. supossing we have two types, rowa.xml</p> </blockquote> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="50px" android:layout_gravity="center_horizontal" android:background="#FF0000"&gt; &lt;TextView android:id="@+id/row_section" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/imagearticle" android:layout_toLeftOf="@id/Lrightaccessory" android:capitalize="characters" android:textStyle="bold" android:ellipsize="marquee" android:textColor="@color/colorSecciones" android:focusable="false" /&gt; &lt;/LinearLayout &gt; </code></pre> <blockquote> <p>and rowb.xml</p> </blockquote> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="20px" android:background="#00FF00"&gt; &lt;TextView android:id="@+id/row_section" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/imagearticle" android:layout_toLeftOf="@id/Lrightaccessory" android:capitalize="characters" android:textStyle="bold" android:ellipsize="marquee" android:textColor="@color/colorSecciones" android:focusable="false" /&gt; &lt;/LinearLayout &gt; </code></pre> <p>And the in your getview() function you decide in wich position inflate your different layouts.</p> <pre><code>public View getView(int position, View convertView, ViewGroup parent) { View result=convertView; if (result == null) { if (position == 0) { //Inflating row type A LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); result = vi.inflate(R.layout.rowa, null); views.set(position, result); } else if (position == 1) { //Inflating row type B LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); result = vi.inflate(R.layout.rowb, null); } } return result; } </code></pre>
 

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