last day (15 days later) » 

15:10
0
Q: Recyclerview items not covering entire screen

Iqbal SinghI am struggling with a bug for a couple of days. For some reason, my recycler view items don't cover the entire screen. Here is the code : feed_fragment.xml <?xml version="1.0" encoding="utf-8"?> <layout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.andr...

do you set width and height in android:background="@drawable/post_border" ?
Hi @saeedata, Thanks for replying. No, I don't set width and height in post_border
about height i khonw your problem is android:layout_height="wrap_content"
you should set fixed height or set maxLines but about width I should test your code
So, if I didn't get it wrong, you suggest I change layout_height of the constraint layout of item_feed.xml ?
no of this textView android:id="@+id/post_content"
15:10
I tried giving it fixed height, however, the problem is still there. :( It is quite weird though because if I add another view (please check the updated question), the items cover the entire screen
did show the height of cell correctly?
ok , just the width is show wrongly, yes?
Have you tested in other devices?
15:12
I would also like to thank you for looking into my problem. I really appreciate it
@rahat Yes I did
this issue coming in emulator?
let change the width to match_parent
I don't use emulator , but i tested on 3 physical devices , same problem
it covers the entire screen , however the text appears in the start
what is the issue exactly?
the item not matching the width of device or text are at start?
?
Once I changed the width to match_parent as you suggested, however now the test appears in the center, and I would like to appear at the start.
text*
15:20
ok, but width of cell is ok now?
from the code, I can say that the content text is coming at the start, but the username and author name are coming at center, right?
No the content text is coming at center
Else everything is fine
but your xml says that the gravity is set to start
insted of alignment use android:gravity="start"
15:26
@saeedata Yes
i mean remove textAlignment
do what @saeedata said remove text alignment use gravity property only
I did , same problem
I removed text alignment, and used android:gravity="start"
I also sent you a screenshot above
just for test remove margins your device screen seems small , test it and send another screenshot and changed codes
15:30
Okay
I turned on ShowLayoutBounds in the developer options to see the layout bounds. Here is the screenshot : ibb.co/RYM5c1j. Now if there is large amount of text, it seems to work fine, however if there are few words they appear in the center, however I would like them to appear at start.
send layout codes again
Okay
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">

<data>

<variable
name="post"
type="com.example.bookally.firebase.PostContent" />
</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/post_border">

<ImageView
android:id="@+id/author_profile_picture"
android:layout_width="48dp"
and what about this style="@style/SubHeading"
send this code too
<style name="SubHeading">
<item name="android:textSize">18sp</item>
<item name="android:textColor">@color/black</item>
<item name="fontFamily">@font/regular</item>
<item name="android:gravity">center</item>
</style>
<item name="android:gravity">center</item> ://///
did you found it?
15:38
Oh silly me !!!
Thanks again mate
Hope you have a great year
your welcome :))
approve my answer , hahaha
tnx , good luck
15:44
I just ran the code, however there is same problem
There was another answer
I tried it , and it worked.
Actually the problem was onCreateViewHolder
and not in our item
layout
Thanks by the way
I upvoted your answer tho !

last day (15 days later) »