I have taken the horizontal list view.I am able to display the images in list view.It is displaying all the images horizontally.But my requirement is i need to show only 4 images in a row.If there is 5th image then it should come in the second row(for each row there should me only 4 images).How can i do this.Actually i am struck up here.I think you are able to understand my problem.Thank You.
I am using JavaFX 2.x
As far as I understand, if you need to allocate only 4 images in a row, and the 5th+ images transfer on the next row, you will be able to use a GridPane :
http://docs.oracle.com/javafx/2/layout/builtin_layouts.htm
where you could obviously set position of ImageView. Seems, it works so : you determine your own ListCell, and set its graphic node to be a gridpane, and configure grid pane as you wish.
Also, take a look on a flow pane, possibly, it will help you.
If I'm wrong with a recipe, please, try to describe your trouble again (code/screenshot). I'm not comletely sure about it.
Related
I have been trying to create a ScrollingView on Xamarin.ios for several days now which shrinks and enlarges when I establish it, showing a larger scrollable part and hiding the empty part if necessary. I'm trying to handle it like this:
ScrollView.ContentSize = new CGSize(View.Bounds.Width, ViewBackground.Bounds.Height - (StackEsercizio.Bounds.Height * 1));
This statement works partially, only when placed in the ViewDidAppear and only for the first time. Do you have any advice or solution?
Finally, I solved it on my own. For the growth of the community, place the solution on github at this link: https://github.com/aleledda98/MyfitnessApp/blob/master/CreaSchedaNew.cs
the scrolling view moves dynamically based on the number of letters entered on a specific UITextField, thanks to all the same <3
I am using bootstrap forms. In a form group I have some check boxes. When I hover my mouse over the first one, it highlights the first one as expected. When I hover over the second one, it highlights the second one and the first one. When I hover over the third one, it highlights the third one and the first one. And so on... I'm wondering if this is a known bug with bootstrap? I'm using nodeJS with pug on express server. Her is my code:
.form-group.centerCheckboxes
label Local Center Statistics
.form-check
label.form-check-label
input#tutorRequestFrequency.form-check-input(type='checkbox' value='tutorRequestFrequency')
| Tutor request frequency
.form-check
label.form-check-label
input#totalWorkingHours.form-check-input(type='checkbox' value='totalWorkingHours')
| Total working hours
.form-check
label.form-check-label
input#totalHoursTutored.form-check-input(type='checkbox' value='totalHoursTutored')
| Total hours tutored
.form-check
label.form-check-label
input#totalWeightPulled.form-check-input(type='checkbox' value='totalWeightPulled')
| Tutors "weight pulled" ratios
perhaps I am using bootstrap classes wrong? This is all within a grid system but I've triple checked the grid to make sure all the numbers rows and columns were used properly. Has anybody ever heard of this problem or know why it is happening?
I found the issue. It's because I was using the label tag incorrectly. when I hovered over anything within the .form-group it was also hovering over the label which was automatically being applied to the first checkbox in the list.
To solve this, instead of using label I instead used div then put the text that was originally inside the label inside the div.
I'm developing a custom table component for very large and very custom content. Therefore I decided not to go with TableView, but start from scratch (i.e. Control). I adopted the idea of the VirtualFlow to create and manage only the visible part of the table and reuse cells that have become invisible. However I needed virtual rows and columns.
My CustomVirtualFlow implements layoutChildren(). From the component's size and scrollbar positions I know which cells are visible. If necessary, I add cells to the VirtualFlow. I then update the content and css pseudo class states (selected, focused, ...).
This works almost fine ... currently, my only problem is that the css styles are sometimes lagging: newly created cells are shown with e.g. wrong backgrounds for a moment and then get correcteted with the next pulse.
My explanation for this is that JavaFX performs layout in two passes:
first a css pass and secondly the layout pass that calls layoutChildren().
The css of newly added children (during layoutChildren) is therefore not processes correctly.
I tried to call applyCss() directly, which helps, but seems to do too much because it takes a lot of time.
My question is:
How is the correct way to add nodes during layout, i.e. if the size of the component makes it neccessary to use further nodes?
If it is not during layoutChildren(), where else should I do it?
I am developing the following screen
The fourboxes next to each other are buttons. On clicking of the buttons I am changing the adapter of the listview.
Since the content above the listview took up lot of space I made the whole thing as an header and added it via code.
myPollsList = (ListView) findViewById(R.id.listArea);
myPollsList.addHeaderView(getLayoutInflater().inflate(R.layout.profile_listview_header, null));
Now I want to show some view when the list is empty. But if I do that then the header also goes away.
I am using this in a Activity and not a ListActivity. Any suggestions or workarounds for showing the header even when the list is empty ?
EDIT: Refer to my earlier question here ListView not getting space to show content on smaller screens . This is where someone suggested me to solve the problem by putting it as a header
I found a simple solution for this problem. If there's no elements for list and you are not adding the adapter, just add this:
mListView.setAdapter(null);
and the header will appear. It's easier than adding empty / fake item to the list.
So this is how I solved it. I had a custom adapter which was connected to the listview. When it found that it had zero items to display. It would add a fake empty view as an item to the list.
maybe you will like this Android addHeaderView disappears when no items in ListView
override/subclass your adapter to return false from isEmpty()
Don't use top layouts of button as header for list view.
So to adjust UI without using list header use weights.
Give parent Linear layout weight sum as 4 and 1, 1 to top Layouts and 2 for list view.
Form containerForm=new Form(filename);
StringItem label1 = new StringItem("","Test\nTest2\nTest3");
StringItem label2 = new StringItem("","Test\nTest2\nTest3");
label2.setLayout(Item.LAYOUT_LEFT|Item.LAYOUT_TOP|Item.LAYOUT_SHRINK );
label2.setLayout(Item.LAYOUT_RIGHT|Item.LAYOUT_TOP|Item.LAYOUT_SHRINK );
containerForm.append(label1);
containerForm.append(label2);
display.setCurrent(containerForm);
This code produces this:
I want it so the two StringItems are next to eachother, and test is lined up with test, and so on.
I've also tried combining the two stringitems into one and adding a tab (\t) between them. The tab turned into nothing, however.
if you're on MIDP 2 it would be safer to also set LAYOUT_2 in addition to directives you already have set. Per my recollection of API spec, without this flag device may (or maybe even should) fall to MIDP 1 layout style ignoring your precious TOP and SHRINK.
Consider also using Item.setPreferredWidth(containerForm.getWidth()/3) to explicitly indicate that you want it to be not too wide. There seem to be small (but non-zero) chance that stupid device believes that preferred width of your string items is that of the screen which in turn somehow overrules shrink directive.
Java ME uses a row layout, which means every item you add is added in the next row of the GUI. You need something like a GridLayout which is not available in Java ME. Maybe you have to write your own Item which contains both labels. Similar to here. Here is a stackoverflow question on Gridlayouts in Java ME: Table or gridlayout in J2ME
Use the GridLayout using LWUIT
http://lwuit.java.net/tutorial/layouts.html