question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom layout inside adapter

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:1
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
MickaelRomaniellocommented, Apr 28, 2016

Hi, Can you explain, how you have solved your issue ?

0reactions
abhimuktheeswararcommented, May 16, 2016

@The-RobinHood can u please tell us, how u solved the issue ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Changing Layout file on custom adapter depending on activity ...
The only thing that needs changing is the layout file. This is my custom adapter: package com.example.placesofinterest; ...
Read more >
Android ListView with Custom Adapter Example Tutorial
In this tutorial we'll use a CustomAdapter that populates the custom rows of the Android ListView with an ArrayList .
Read more >
Custom Adapters with RecyclerView
Adapter requires a ViewHolder . A ViewHolder is an object that stores multiple Views inside the tag field of the Layout so they...
Read more >
How to create custom RecyclerView adapter with multiple ...
Before attaching a Custom Adapter to the RecyclerView, make sure you have included the RecyclerView view tags in the layout (xml) file.
Read more >
View Binding in RecyclerView with Custom Adapter in Android ...
Feel Free To Contact Us Here http://www.aaviskar.com/support.phpThis video shows how to use view binding in adapter android.you ma...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found