Answer the question
In order to leave comments, you need to log in
Items in a ListView are stacked on top of each other. How to fix?
Hello, earlier in the markup for the ListView I used LinearLayout and everything worked fine, but then I needed to replace the regular button with one drawn by me (more precisely, it's just a frame with a transparent background), I did it like this:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/cen"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/back"
android:orientation="horizontal">
<ImageView
android:id="@+id/button2"
android:layout_width="144dp"
android:layout_height="52dp"
android:layout_weight="1"
android:onClick="vip"
app:srcCompat="@drawable/ramka" />
<TextView
android:id="@+id/data"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:layout_marginLeft="40dp"
android:layout_marginTop="15dp"/>
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="150dp"
android:text="TextView" />
</FrameLayout>
Answer the question
In order to leave comments, you need to log in
This is because your FrameLayout has android:layout_height="match_parent". Its Parent is RecyclerView, its height is taken. Do android:layout_height="wrap_content"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question