I have a TableLayout, creating this table:
And I simply want the background color to fill the space given, rather than matching the content (however it does extend horizontally?)
How would I go about doing this? I set the individual TextViews to fill_parent, but that caused errors...
Edit: XML is here:, as it's pretty big
Related
I am a beginner, and i tried to find an answer but everything i found was from 2013 and earlier. I want to create a grid which you can scroll in any direction, (as a zoomed in picture), which contains items of different sizes which are generated randomly, then i want to populate them with a recycler view. I will attach an illustration, maybe you would understand it better.As you can see, the thick outline is the phone screen and whenever you scroll the view, it generates new items which are populated by a recycler view.
I thought of using Google's FlexBox Layout for generating the items but i don't really know how to create that scrollable view. I would literally pay to get this done.
I don't think you can make RecyclerView scroll in Both way. U can Create Nested RecyclerView if that is what you are looking for.
I would like to add dynamic icons to column headers. To do this I've created a class that extends CellPainterWrapper and added a CellPainterDecorator with a TextPainter as the base painter and my dynamic icon painter as the decorator painter.
If I then swap the CELL_PAINTER in the config to use my class instead of the TextPainter the table doesn't display. If I click on where a row should be it then resizes and displays the table as expected with the column header text and icons.
I've also tried using the SortableHeaderTextPainter and get the same issue occur.
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new SortableHeaderTextPainter(),
DisplayMode.NORMAL, GridRegion.COLUMN_HEADER);
Overall this means there is something different with how TextPainter and SortableHeaderTextPainter is implemented. In particular I can see parts in TextPainter that will call commands to resize the layer but I'm struggling to figure out how this should be done.
What needs to be added for it to set the initial column/row sizes?
Either set the initial widths and heights via DataLayer or configure the TextPainter to calculate the dimensions. Either via setter or constructor parameter.
This is caused by one any of the painters having paintBg set to true and by my style not specifying the background color. No exceptions would be thrown but it would cause my table to not resize automatically.
To fix this I can either set paintBg to false for all of my painters or set the background color in the style.
I want to add images and text in a textview.
My code:
txtViewNews.setText(" text "+VAR11+" text");
txtViewNews.setCompoundDrawablesWithIntrinsicBounds(R.drawable.a1a, 0, 0, 0);
It works. On left side there is the image and on the right side there is the text.
But I want to add another image and another text under the first image and text. But how?
Use layout managers. Like Linear layout with vertical orientation in a grid layout. Nested Layout.
Can't understand why you need this while you can add listview which will grow when additional row will get added. Simple.
I'm trying to build a simple interface for an assignment, in which multi-line word-wrapped input boxes can be stacked vertically in a single, fixed-width column. then the whole stack (if tall enough) has to scroll vertically inside of a scroll pane with the same fixed width and a fixed height.
The active box has to change height dynamically to fit the amount of text as it is being typed/deleted. This means the y position of all subsequent inputs in the column should change accordingly. A layout manager's job, right?
I started reading about the swing layouts, and it seemed like only the GridBagLayout could do this. Since this is my app's only interface window, it seemed like a clunky layout to achieve something simple.
So, which swing layout should I use, along with which text input class for word-wrapping and auto height adjustment? Thanks.
A BoxLayout might be what you are after for this use-case.
I have a custom popup window with a custom image background in which I need to place three custom buttons with their own background images. I have only one set of images for all the components, so I want all the parts to scale appropriately. My question now is how do I make sure that the buttons line up with the appropriate parts of the background image of the popup window. I have been experimenting with all sorts of widths and heights and I can not make it look consistent on all my test devices. Can anyone give me some pointers?
EDIT: Just to make it as clear as possible, the image below illustrates the kind of thing I am talking about:
I want the graphical button to line up with the arrows which are a part of the popup window background image.
arrange buttons in an xml layout and set this view to your custom popup and you can set images to buttons from code.