flowlayout

UICollectionViewFlowLayout minimumLineSpacing not applied to whole collection view - Swift

穿精又带淫゛_ 提交于 2019-12-12 01:13:40
问题 I'm creating UIView subclass for calendar, wherein UICollectionView with flow layout is used to display dates. The code is : override func draw(_ rect: CGRect) { super.draw(rect) . . configureCalendarView() . } func configureCalendarView() { cellWd = Double(self.frame.size.width)/7.0 let layout = UICollectionViewFlowLayout.init() layout.minimumLineSpacing = 0.5 layout.minimumInteritemSpacing = 0.0 layout.sectionInset = UIEdgeInsetsMake(1, 0, 0, 0) collectionV = UICollectionView.init(frame:

FlowLayout in Swing doesn't move to the next line

為{幸葍}努か 提交于 2019-12-11 17:54:25
问题 I'm using a flow layout inside a scroll panel. I keep adding button expecting them to add to the next line when there is no more available space, but they just keep adding. I want the scroll bar to only scroll vertically, not horizontally. My code: JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 6, 6)); for(int i = 0; i < 30; i++) panel.add(new JButton("asd")); 来源: https://stackoverflow.com/questions/50192589/flowlayout-in-swing-doesnt-move-to-the-next-line

Flow layout with nested container

﹥>﹥吖頭↗ 提交于 2019-12-11 02:07:00
问题 In my Ext JS 6 app, I'm trying to create a flow layout with 3 containers, with the middle container having nested items that need to continue with the flow layout. I can get this working if I add the middle container's items directly, but I don't want to do that... I want them to be separate. Here's an example: Ext.application({ name: 'Fiddle', launch: function () { Ext.create('Ext.panel.Panel', { height: 300, width: 300, scrollable: true, renderTo: Ext.getBody(), title: 'Not properly working

FlowLayout not flowing with JScrollPane around it

浪尽此生 提交于 2019-12-10 17:56:40
问题 I have a bunch of buttons on a JPanel using a FlowLayout. It looks really nice. When the buttons reach the right side of the panel they start out on a new row creating a nice 2-dimensional grid. Here is the code: Container cp = getContentPane(); JPanel panel = new JPanel(); panel.setLayout(new FlowLayout()); for (int i = 0; i < 20; i++) panel.add(new JButton("Button " + i)); cp.add(panel); However, the minute I put the panel in a scroll pane with only vertical scrolling: Container cp =

Scale components in FlowLayout as big as possible

妖精的绣舞 提交于 2019-12-08 06:11:20
问题 How can I scale PictureBox components to best fit the given space on the screen while keeping their aspect ratio (interdependent of the actual image or its SizeMode) ? I tested setting the Dock of the FlowLayout and the PictureBox to Fill. I also tested using a Panel as a wrapper and tested different settings for AutoSize and AutoSizeMode. To give more information about the background: I want to dynamically add and remove images in the viewport of the application, so a TableLayout is in the

How to make BoxLayout behave as vertical FlowLayout?

只谈情不闲聊 提交于 2019-12-07 13:04:29
问题 FlowLayout performs "pressure" from the right, so as all components are trying to take their minimal widths. Contrary, BoxLayout tries to spread all components to fill entire height of the space. Can I add some filler as last component or something to make all components have minimal heights in BoxLayout ? 回答1: You could use Box.createGlue(), which returns a component that takes up as much space as the BoxLayout will give it. Adding it to the bottom of a vertical BoxLayout will scrunch the

UICollectionView layout of last cell

ⅰ亾dé卋堺 提交于 2019-12-06 20:16:23
问题 I have a collectionview which has a UICollectionViewFlowLayout I put 10 items in it. and they have different sizes: - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.row<6) { CGSize retval = CGSizeMake(100, 100); return retval; } CGSize retval = CGSizeMake(200, 130); return retval; } it layouts like: first 6 cells look good, and 7-9 are correct, but the last one is

UICollectionView custom flow layout crashes on scrolling

流过昼夜 提交于 2019-12-06 10:10:57
I am creating a custom flowLayout with section headers. here is my flowLayout.swift import UIKit class FlowLayout: UICollectionViewFlowLayout { override func layoutAttributesForElementsInRect(rect: CGRect) -> [UICollectionViewLayoutAttributes]? { // let attributesForElementsInRect = super. var newAttributesForElementsInRect = [UICollectionViewLayoutAttributes]() // unwrap super's attributes guard let attributesForElementsInRect = super.layoutAttributesForElementsInRect(rect) else { return nil } // modify attributes var leftMargin: CGFloat = 0.0; for attributes in attributesForElementsInRect {

How to make BoxLayout behave as vertical FlowLayout?

柔情痞子 提交于 2019-12-06 02:39:57
FlowLayout performs "pressure" from the right, so as all components are trying to take their minimal widths. Contrary, BoxLayout tries to spread all components to fill entire height of the space. Can I add some filler as last component or something to make all components have minimal heights in BoxLayout ? You could use Box.createGlue(), which returns a component that takes up as much space as the BoxLayout will give it. Adding it to the bottom of a vertical BoxLayout will scrunch the other components to the top. You could also use nested layouts. 来源: https://stackoverflow.com/questions

UICollectionView layout of last cell

风流意气都作罢 提交于 2019-12-05 01:19:26
I have a collectionview which has a UICollectionViewFlowLayout I put 10 items in it. and they have different sizes: - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.row<6) { CGSize retval = CGSizeMake(100, 100); return retval; } CGSize retval = CGSizeMake(200, 130); return retval; } it layouts like: first 6 cells look good, and 7-9 are correct, but the last one is not center aligned, any one could explain this to me? and resent days Im playing with collection layouts,