ListView
のheight
をListView
からwrap_content
またはmatch_parent
に設定した場合、これは私のコードです。しかし、高さをdp
で定義すると、私には両方ともListView
と表示され始めます。しかし、その場合は良く見えません。2リストビューを追加する方法
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="40dp"
android:text="ListView1"
android:gravity="center_vertical"
android:paddingLeft="16dp"
android:layout_marginTop="45dp"
android:textColor="@color/white"
android:textStyle="bold" />
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/lv_upcoming"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:divider="@null" />
<View
android:layout_width="fill_parent"
android:layout_height="0.5dp"
android:background="#ffffff" />
<TextView
android:layout_width="match_parent"
android:layout_height="40dp"
android:text="List Number 2"
android:gravity="center_vertical"
android:textColor="@color/white"
android:fontFamily="sans-serif-condensed"
android:textSize="18sp"
android:id="@+id/tvPrevious"
android:paddingLeft="16dp"
android:paddingRight="16dp" />
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/list_view_2"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:divider="@null"/>
</LinearLayout>
</ScrollView>
ListView
をレイアウトに追加する方法を教えてください。
あなたは決して、ScrollViews内のリストビューを入れていないしてはなりません。うまくいきません。それはとても悪い選択です。本当に、別の考え方。 – Aspicas
'ScrollView'の代わりに' NestedScrollView'を試してみてください –