Прошло много времени с тех пор, как я сделал некоторые Android, и теперь я хочу вернуться к нему. Я по-прежнему пытаюсь понять концепцию использования Фрагментов правильно и что будет надлежащим образом сделать, что мне нужно.Фрагменты, открытки, списки и изображения
К пункту. Мне нужно иметь представление Main, которое (на данный момент) содержит одну карту. Эта карта будет содержать TextView и ListView с настраиваемыми элементами (одно изображение и две строки текста). Как бы это реализовать?
Нужно ли делать другой фрагмент для спискаView и еще один для карты? Я знаю, что мне нужен пользовательский адаптер для просмотра списка, но как я могу все вместе собрать?
Любые советы приветствуются даже в самой простой форме диаграммы.
fragment_main.xml
<LinearLayout 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:background="@color/white"
tools:context=".MainActivity$PlaceholderFragment"
android:paddingLeft="5dp"
android:paddingTop="10dp"
android:paddingRight="5dp"
android:paddingBottom="10dp">
<android.support.v7.widget.CardView
android:id="@+id/accounts_card"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_gravity="top"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minHeight="150dp"
android:layout_marginLeft="5dp"
card_view:cardCornerRadius="0dp"
card_view:cardBackgroundColor="@color/white"
card_view:cardElevation="3dp"
android:layout_marginRight="5dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="5dp">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/accounts_title"
android:layout_width="match_parent"
android:layout_height="match_parent"
style="@style/Base.TextAppearance.AppCompat.Caption"
android:elevation="1dp"
android:text="My Accounts"
android:gravity="top|center"
android:textStyle="bold"
android:textSize="20dp"
android:paddingTop="15dp"
android:paddingBottom="15dp" />
<ListView
android:id="@+id/accounts_list"
android:layout_below="@id/accounts_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
</RelativeLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
my_listitem.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/account_item">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/b_logo"
android:elevation="1dp"/>
<LinearLayout
android:layout_alignEnd="@id/b_logo"
android:paddingLeft="2dp"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="right">
<TextView
android:id="@+id/account_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="9959593922923"/>
<TextView
android:id="@+id/account_code"
android:layout_below="@id/account_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="30-15-55"/>
</LinearLayout>
</RelativeLayout>
спасибо , это довольно информативно. Мне потребуется некоторое время, чтобы пройти через все это, и я вернусь к вам – MayTheSchwartzBeWithYou