RecyclerView Remove/Add animations overlapping divider - android

I would like to know if it's possible to have the add/remove animations not overlap the divider like in the following video:
https://www.grokkingandroid.com/wordpress/wp-content/uploads/2014/08/recyclerview_animation.mp4?_=1
I am unsure as to how I can make the divider be bound to the item and not the view. Any help is useful.

Check the divider in SupportV7Demos app in AOSP. Basically, you should consider View's translateX/translateY properties when positioning your dividers.

Related

Removing default padding in listview items within Android studio

Can someone provide me with any insights on how to remove the default padding around a listview item? I have provided an image with arrows indicating what padding I am talking about.
You need to create custom a custom layout file for your list items. And a custom adapter. Then you can control all the appearance.

RecyclerView scrolling shadow

I'm trying to create a scrolling sheet of paper containing a RecyclerView. To achieve this I gave each item a background and its own shadow. When you look closely you can see where the items meet because the shadow is slightly darker. The left list also has a divider which has the wrong color because the shadow is behind it.
I was wondering if there may be a better solution for this. You can't set the background and shadow on the RecyclerView itself because then it wouldn't scroll of the screen as the bounds don't change. You can't use a LinearLayout+ScrollView because this would break when there are too many items.
I would say just use CardView and set useCompatPadding to true in your XML so that it adds enough padding for the shadows not to overlap.
Alternatively, you can add margin to your items.
Another option is using an ItemDecorator that does not draw anything but returns enough margin for shadows in the getItemOffsets method.

Removing Dividers and Adding Space between Expandable List Groups Android

I'm working on my theme in android and am having a heck of a time getting my Expandable List Views to look right. Here is my desired effect.
Collapsed
Expanded
So I primarily want the space between each List Group. And since android also adds those dividers I want to get rid of all of them.
Here is what I'm getting without trying any trickery.
Collapsed
Expanded
I assumed the best way to get my desired look would be to put a margin on the list group layout xml file but I get end up getting this. It does not put a spacer on my group indicator and also puts the space between the group and the child which I don't want.
Collapsed
Expanded
Any help or a push in the right direction would be greatly appreciated. Thank You!
You can use these properties of listview dont know if it will solve your problem though:
android:divider="#FFF" // same as your background
android:dividerHeight="0dp"//for not showing one
android:divider="#android:color/transparent" //setting divider to transparent
android:dividerHeight="-1dp"//setting negative height also works but only on relative and linear layout according to google engineers but I have tested it to work in many scenarios use this with care

ListView Scrolling

I have three items in a ListView. The reason I have chosen the ListView is so I can use a Divider and a List Selector on these items.
However I do not need/want the scrolling aspect of the ListView. Ie. When I select/drag an item from the list, I dont want it to scroll..
Is it possible to disable this somehow? Or will I have to add the items using a LinearLayout and find another way of using a list divider and selector?
I'm not sure how well this will work for you, but you can disable overscroll (available in android-9 and above):
listView.setOverScrollMode(View.OVER_SCROLL_NEVER);
and then also hide the scroll bars:
listView.setVerticalScrollBarEnabled(false);
After this, if your list does not exceed the screen size then it shouldn't be able to scroll.
If you dont need to scroll listview, you can add the list item to a linear layout as well you can design it also through xml file.
And for put a DIVIDER to it just take a "View" widget.
Put it height 1 dip and width fill_parent. You can give color to this view through background color.
Try it. i have done it many times.

grouping texts plus images + round edges in android

i was requested to make in android a view that groups several items like checkboxes or text views in vertical rows, separated by transparent dividers while the background is with a certain alpha level and the edges are round.
I thought of two solutions and i hope for some feedback on good\bad or other solutions if you got'em.
just use regualr linear layout but have a single style A that uses a 9 patch as background, includes padding,margins and whatever i need to make it look like what i want. i then create another style A.up and A.down that represents the upper most and lower most items that will use a different 9-path with round corners.
inherit from linear layout, in the onMeasure and layoutChildren add to all the children some kind of space between them, i can create new attribute for it that can be customized in a style. i can override the dispatchDraw to paint the background for each view before it draws so i can paint my round borders, my only demand will be that each View added to this layout will have to be with transparent background.
So what do you think ?
Eventually i decided to use a List with customized divider.
It looks good, however a list got a very nasty bug when it comes down to items with states like buttons and clickable textViews,
you get no focus for the item and don't see the ornage bar
you don't seem to get the evnets flowing to the children of the View in the list.
I'm notsure how to resolve that one, i've seen numerous mails about it in the developres mailing list and here, most saying don't put statefull objects in a list.
So it mist not be the solution for me.
Nest thing i'll try is extending the normal layouts to have a bar in their bottom and use regualr linear layout with round corners drawable.

Categories

Resources