Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>This layout is a ListView. You can control ListViews row contents by creating an adapter and an adapterview class. The entire code is too extensive to post on here, but I will try and give you the gist of it.</p> <p>main.xml: </p> <pre><code>&lt;ListView android:id="@+id/lvList" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;/ListView&gt; </code></pre> <p>Prog.java:</p> <pre><code>List&lt;MyClass&gt; myClassList = = new ArrayList&lt;MyClass&gt;(); ListView list = (ListView)findViewById(R.id.lvList); MyClassAdapter adapter = new MyClassAdapter (this, myClassList); list.setAdapter(adapter); </code></pre> <p>MyClassAdapater.java:</p> <pre><code>public class MyClassAdapater extends BaseAdapter { private Context context; private List&lt;MyClass&gt; list; public MyClassAdapater(Context context, List&lt;MyClass&gt; list) { this.context = context; this.list= list; } public View getView(int position, View view, ViewGroup viewGroup) { MyClass entry = list.get(position); return new MyClassAdapterView(context,entry); } } </code></pre> <p>MyClassAdapterView.java:</p> <pre><code>public class MyClassAdapterViewextends LinearLayout { public MyClassAdapterView(Context context, MyClassentry) { super(context); this.setOrientation(VERTICAL); this.setTag(entry); View v = inflate(context, R.layout.row, null); ... addView(v); } } </code></pre> <p>From there you'll need to create a new xml file "row" that contains a LinearLayout of the content you want.</p>
 

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