Android Leanback: Reduce rows spacing in RowsSupportFragment - android-tv

I'm trying to create a vertical list of selectable items in Android TV using Leanback RowsSupportFragment. There seems to be some default spacing, shown as black color in attachment, between rows here. I need to remove this spacing. I've looked into some dimens attributes but they are setting the spacing globally while I only require it on a particular screen. How this may be achieved?

Try using the setVerticalMargin (or setItemMargin ?) methods of the VerticalGridView widget in RowsSupportFragment:
getVerticalGridView().setVerticalMargin(25);

Related

Can i make tree graph where button means leaf?

id like to do something like tree graph with buttons. Idk how to explain my idea so ive created image. I build my website via Elementor. Is it even possible please?
My image
You can do this in one section using buttons and dividers, set width for the divider, and set it using margin and padding

AEM Grid - How to add spacing between columns in AEM grid

We are on 6.5.3. Like in CSS/bootstrap, there is a property to add the spacing between grid columns. I would like to know if there is any way to achieve this in AEM Grid? We need to add some gaps to ensure content doesn't stick together when content is placed inside the column grids. Modifying the grid.less is an option that we are thinking of as last resort, but we would like to check if there is a declarative way from the AEM grid, for example specifying the spacing in some property.
There is no property for padding/margin in AEM grids by default, this is the reason we have grid.less file in place OOTB. But,you can edit and add a property in your templates for that.
Although, this is not the best approach
If you want to add default spacing in all the grids, you have to do it in grid.less.
This would be even worse, as these changes would be global
A Better Approach
I would suggest to create a spacer component instead of adding a default padding in all grids. That way, when you don't want padding in your grids you wouldn't get stuck again.
Content Authors can just add a spacer component(or multiple) in between different components depending upon the size of padding/margin you need.
Customizing AEM Grid

Is there anyway to add a icon in the Entry placeholder?

I can not use a Background Image because cannot fix the position of the start point.the placeholder text is centered.so it is not duplicated.
How to add an icon in the placeholder of an Entry beside using Grid or Layout. Just add it in the placeholder.
I want to make an Entry with placeholder containing an icon . Which is center in the Entry so that I can not use grid or layout to add a Image because this is not the best way.
I think I will have to make clicked event functions of the Image and the entry focus to hide the Image.
The expected result is like that:
Entry
The first way I can think of doing this:
If the icon you would like to use is a generic icon, FontAwesome is a fantastic fontkit that displays icons in the place of text. I have implemented it into Xamarin Forms many times. Here are some tutorials on how to do that:
https://www.wintellect.com/using-fontawesome5-xamarin-forms/
https://doumer.me/icons-with-font-awesome-5-xamarin-forms/
What you would do is set the FontFamily of the entry field to FontAwesome, and then add a textchanged event on text length > 0 change the fontfamily to your normal font, on text length = 0 (Place holder displayed) Change font family to FontAwesome.
The second way I can think of doing this:
Create a Xamarin Forms Custom Renderer for all of the platforms you are using. whereby you will on the native level alter how the Entry field functions to display an icon in its placeholder. To do this you will either need some native expierience on both platforms or some patience and learning about the native platforms.
If you need further help feel free to drop a comment :)

qt unexpandable layout?

Ok, here is my problem:
I have a vertical layout which contains a QPlainTextEdit and a horizontal layout (containing 2 QPushButtons) below the text edit.
The vertical layout is just a part of GUI, and gets resized depending on screen resolution. Btw. it is a mobile app, so I don't have a lot of space on screen.
Push buttons have some text which is dynamically set, I don't know it from the beginning to code it manually.
My problem occurs when the text in push buttons is big, and my whole vertical layout is expanded to fit the buttons.
How can I make the vertical layout unexpandable? note, that this is different from "fixed" because of different screen resoulutions.
I'd just like the clip the buttons if they do not fit, but keep the layout width untouched.
Anyway to do this?
You'll need to set the maximum width for the buttons, not the layout, which is only widening to fit the wider buttons. Check out the docs on QPushButton and look for QWidget inherited functions called setMaximumSize or setMaximumWidth.
You can always GetWidth() on the button when it is an appropriate size, then setMaximumWidth using that value since you wouldn't ordinarily know this. Pick an appropriate default text size/val and use that to create your "dynamic" default since this is going on screens of varying size.

How to layout out a component differently depending on the amount of space available?

I am trying to build a sort of button bar in Flex - something like the horizontally laid-out bookmark bar you'd see in most modern web browsers, where when you run out of horizontal space, you can click on the arrows button(>>) to get a drop-down to see the rest of the items which did not fit into the horizontal space. Problem is, how can I know how much horizontal space is available for me to tell how many buttons to render into the button bar? This need doesn't appear to be support by the general layout manager framework.
You can check the width of the parent container, and if that is less than the combined widths of your objects that you've attached with AddChild or AddElement, then you don't have enough space and need use your arrow functionality.

Resources