How to combine (row 1 column 1), (row 2 column1), (row 3 column 1), and (row 4 column1)

28 Views Asked by At

Good evening sir/ma'am. Sorry for disturb your time. I am a student from Indonesia . I have a problem in make table with kotlin using card view. My lecturer gave me a design which i should make. This table design like this image which my lecture gave. So, I tried make this My Design. So, my question is how to combine (row 1, col 1),(row 2, col 1), (row 3, col 1), (row 4, col 1) (my question) in my table layout? So that, the image will look center in the table. It is possible or not sir? That's all my question. Thank you verymuch. This is my cardView code

<?xml version="1.0" encoding="utf-8"?>
<ScrollView
    xmlns:tools="http://schemas.android.com/tools"
    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="match_parent">
        <androidx.cardview.widget.CardView
            android:id="@+id/cardBarang"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:backgroundTint="@color/gray">

            <TableLayout
                android:centerInParent="true"
                android:gravity="center_horizontal"
                android:layout_gravity="center_horizontal"
                android:id="@+id/tbl2"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_marginBottom="10dp"
                android:layout_marginTop="10dp"
                >

                <TableRow>
                    <TextView
                        android:layout_column="1"
                        android:text="Nama Barang"
                        android:textColor="@color/white"
                        android:textSize="16sp" />
                </TableRow>

                <TableRow>
                    <ImageView
                        android:layout_span="1"
                        android:id="@+id/gambar"
                        android:layout_width="120dp"
                        android:layout_height="120dp"
                        android:src="@drawable/laptop2"
                        />
                    <TextView
                        android:layout_span="1"
                        android:layout_height="80dp"
                        android:layout_column="1"
                        android:text="Keterangan"
                        android:textColor="@color/white"
                        android:textSize="12sp" />
                </TableRow>

                <TableRow>
                    <TextView
                        android:layout_column="1"
                        android:text="Harga"
                        android:textColor="@color/white"
                        android:textSize="14sp" />
                </TableRow>
                <TableRow
                    >
                    <ImageView
                        android:layout_column="1"
                        android:layout_width="50px"
                        android:layout_height="50px"
                        android:src="@drawable/love"
                        android:paddingLeft="70dp"

                        />
                    <TextView
                        android:layout_column="1"
                        android:id="@+id/promo"
                        android:text="Promo"
                        android:textSize="14sp"
                        android:textColor="@color/red"
                        android:textStyle="bold"
                        />
                </TableRow>
            </TableLayout>
        </androidx.cardview.widget.CardView>



    </RelativeLayout>
</ScrollView>
0

There are 0 best solutions below