I am currently trying to create cash register based app with 5x5 grid to display all the menu. I used GridLayout with CardView to display them. 1 CardView with linearLayout+ Imageview + TextView resulted in total 4 views, so 5x5 cardview made my xml end up with 100 views...
I tried to use include tags for the linearlayout+ imageview+textview inside the cardview, which brought the views down to 50 views only.
But the problem now is: I'd like to change the text and image src
inside the include tags, otherwise I cant display all the menu images. Is this even possible?
Any suggestion for my problems?
<android.support.v7.widget.CardView
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_marginBottom="16dp"
android:layout_marginStart="16dp"
app:cardPreventCornerOverlap="true"
app:cardElevation="8dp"
app:cardCornerRadius="8dp">
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:weightSum="100"
android:orientation="vertical"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:layout_gravity="center"
android:layout_weight="70"
android:src="@drawable/noimage"
android:contentDescription="@string/logo" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textSize="18sp"
android:textColor="#A9A9A9"
android:layout_weight="30"
android:textAlignment="center"
android:autoSizeTextType="uniform"
android:text="@string/logo"/>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_marginBottom="16dp"
android:layout_marginStart="16dp"
app:cardPreventCornerOverlap="true"
app:cardElevation="8dp"
app:cardCornerRadius="8dp">
<include layout="@layout/menu_cardview"/>
</android.support.v7.widget.CardView>