-1

リストに関する仮定 (更新):

  • 10 個を超えるリスト要素は含まれませ(リスト要素は以下の xml レイアウトによって定義されます)。
  • リスト要素には最大20 個の子ビューLinearLayoutを持つことができる が含まれているため、すべての要素の高さは不明です(以下の xml を参照)。

リスト要素の XML レイアウト:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation:"horizontal">

    <!--
        This LinearLayout is going to contain one or more 
        Views which will be added progammatically on runtime.
        The number of children views added to it depend on the 
        data to be displayed, and the only assumption that can 
        be made is that there's will be no more than 20 child 
        views for one particular instance of this LinearLayout.
    -->
    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginRight="25dp"/>

    <ImageButton
        android:layout_width="25dip"
        android:layout_height="25dip"
        android:layout_gravity="center|top"
        android:layout_marginLeft="-25dp"/>
</LinearLayout>

質問:

  • ListView(上記のような) 構造に自由度があり、
    渡された convertView を引き続き使用できるレイアウトに を使用することは意味がありListView#getView(...)ますか?

  • LinearLayout別の方法として、すべてのリスト要素をアウターに入れ、これを の中に入れるのは間違っていScrollViewますか? これを行うと、 のキャッシュ機能は得られListViewませんが、リストに関する仮定を考えると、それほど重くはないのではないでしょうか? (上を参照)。(この代替のルックアンドフィールを のようにする方法についての指針はありListViewますか?標準の色とセレクターなどを適用することを考えています。)
4

1 に答える 1

1

10個の要素の一部が同じであることがわかっている場合は、使用できます

getItemViewType(整数位置)

convertView がアイテム タイプ convertView と一致することを確認するには

于 2011-12-30T13:18:05.640 に答える