Skip to content

Custom layout inside adapter #21

@The-RobinHood

Description

@The-RobinHood

I'm trying to add custom layout but getting weird output.

raw.xml

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center"
    android:background="@android:color/darker_gray">
    <ImageView
        android:id="@+id/imageview"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:adjustViewBounds="true" />
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="test"
        android:textColor="@android:color/black" />
</FrameLayout>

Adapter code

Output
aaaa

Image are not display as per aspect ratio, can you please shade the light that where I'm lacking.

This is how It should look (It is created with dynamic imageview but I need to generate view via xml)
bbb

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions