Есть ли способ создать несколько статических карт (определенных непосредственно в макете XML) без использования динамического адаптера?

Есть ли способ создать несколько статических карт (определенных непосредственно в макете XML) в Android без использования динамического адаптера?

У меня есть объект Weather JSON, который я пытаюсь проанализировать с помощью модернизации, и я хочу передать данные статическим картам вместо создания адаптера для них.

XML:

<LinearLayout
    android:layout_below="@id/openweather"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    >
<android.support.v7.widget.CardView
    android:id="@+id/cardView"
    android:layout_below="@id/openweather"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        >
        <TextView
            android:id="@+id/headerSmall1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Test"
            android:textAppearance="@style/Base.TextAppearance.AppCompat.Small"/>
        <TextView
            android:id="@+id/contentLarge1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/headerSmall1"
            android:text="Test"
            android:textAppearance="@style/Base.TextAppearance.AppCompat.Large"/>



    </RelativeLayout>

</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
    android:id="@+id/cardView2"
    android:layout_below="@id/openweather"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        >
        <TextView
            android:id="@+id/headerSmall2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Test"
            android:textAppearance="@style/Base.TextAppearance.AppCompat.Small"/>
        <TextView
            android:id="@+id/contentLarge2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/headerSmall2"
            android:text="Test"
            android:textAppearance="@style/Base.TextAppearance.AppCompat.Large"/>



    </RelativeLayout>

</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
    android:id="@+id/cardView3"
    android:layout_below="@id/openweather"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        >
        <TextView
            android:id="@+id/headerSmall3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Test"
            android:textAppearance="@style/Base.TextAppearance.AppCompat.Small"/>
        <TextView
            android:id="@+id/contentLarge3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/headerSmall3"
            android:text="Test"
            android:textAppearance="@style/Base.TextAppearance.AppCompat.Large"/>



    </RelativeLayout>

</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
    android:id="@+id/cardView4"
    android:layout_below="@id/openweather"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        >
        <TextView
            android:id="@+id/headerSmall4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Test"
            android:textAppearance="@style/Base.TextAppearance.AppCompat.Small"/>
        <TextView
            android:id="@+id/contentLarge4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/headerSmall4"
            android:text="Test"
            android:textAppearance="@style/Base.TextAppearance.AppCompat.Large"/>



    </RelativeLayout>

</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
    android:id="@+id/cardView5"
    android:layout_below="@id/openweather"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        >
        <TextView
            android:id="@+id/headerSmall5"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Test"
            android:textAppearance="@style/Base.TextAppearance.AppCompat.Small"/>
        <TextView
            android:id="@+id/contentLarge5"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/headerSmall5"
            android:text="Test"
            android:textAppearance="@style/Base.TextAppearance.AppCompat.Large"/>



    </RelativeLayout>

</android.support.v7.widget.CardView> </LinearLayout>

0 ответов

Другие вопросы по тегам