Sometimes need to arrange the buttons in a line.
For example, if we send 8 buttons with short text they will appear like this:
1
2
3
4
5
6
7
8
Is it possible to place buttons in a line in the screen area without scrolling to the right:
1 2 3 4 5 6 7 8
Thank you!
Can you provide a screenshot of how they appear ? For me 'quick replies' always appear horizontal.
Thanks
Related
I have a list of 12 images that I would like to display on the screen, however I would like to cap the number of images that can fit onto the screen at 9, with the user having to swipe left to see the remaining 3 images.
I have currently hardcoded it, but I would like to know if there is a way to write it such that a maximum of 9 images will automatically resize themselves to fit onto the page, with future images being shown on the next screen, which the user can swipe to.
e.g. In the future if I have 25 images, first 9 will fit themselves onto the first screen, user can swipe to the second screen to see the next 9 and user can swipe again to see the last 7 - without hardcoding 9, 9, 7 per screen respectively.
You can define a screen that takes the list of images to be shown and the starting number in that list.
Images can be shown with a GridView Widget.
So for your example of 25 images:
ShowImagesScreen([image1, image2 ... image25], 0) will show the screen with the first 9 images, the 0 indicates that the screens starts with the first image (index 0 in the list). Swiping on that page will result in going to the next screen. Which is the same screen widget:
ShowImagesScreen([image1, image2 ... image25], 9) this time showing image 9 till 18. Swiping on this screen can go to previous page or to the next:
ShowImagesScreen([image1, image2 ... image25], 18)
On the screen you make logic to disable swiping back or forward when it is the first or last page respectively. You also need to check the length of the list on each page and check whether you are at the end.
I am running into a problem with layout groups in Unity that I do not understand and was hoping for some insight.
My goal is to create a 12 button keypad contained in the bottom half of the screen of a mobile device that would look something like this:
123
456
789
-0-
My approach to this was to use a vertical layout group to first split the screen into a top half and bottom half and then use another vertical layout group on the bottom half to make 4 rows. Each row would have a horizontal layout group with 3 buttons. The problem I am running into is that when I add the 4 rows into the bottom layout group (bottom half of the screen) it starts to automatically expand and ends up taking up much more than just the bottom half of the screen. In the end I just want the 12 buttons contained in the bottom half of the screen and I keep toggling and playing with child control and force expand but do not understand why the automatic resizing is happening. Any insight would be greatly appreciated, thank you, and wishing you a great day
Just use grid layout group that would solve the problem
I think you can use grid layout and make the fixed column count and get the center layout, and use this github https://github.com/mrbeardy/BeardyGridLayout, I get it from unity forum
Hope you like it :)
the title is my question. Could you please show me the coding instead of telling me how to do as I have no idea how to code. Thanks a million.
i want to align 4 labels horizontally.
This is what i do with constraints in my storyboard :
It's correct for iphone 5 :
It's not correct for others Iphone like Iphone 6 :
How can i do ? I tried to embed my 4 labels in a view but it's not working too.
Thanks !
The last box doesn't have a width constraint, as the other 3 have. Just add it and it will work.
Put in a "positioning" label in between labels 2 and 3. This label is just used to set the center point in auto layouts. Once you've centered this label, you can then set the other labels to be a fixed distance from this center layout.
The result will be the gutter to the left of the 1st label and to the right of the 4th label will expand/shrink based on the device size.
Be sure to put no content or styling on this positioning label, it won't be visible.
I need something like a UIScrollview with flexible pageWidth.
As an example; my scollview has 5 buttons. The middle button is the widest. 2nd and 4th buttons have a smaller width. 1st and 5th button are the smallest in width.
| button 1 | button 2 | button 3 | button 4 | button 5 |
How can I build something like that within a UIScrollView with paging enabled?
If i got your requirement right then please read the following blog post (Alexander Repty) regarding this very topic! It's an older entry but it describes the approach well. In short, it's not as simple as just changing the width of the "page" but managable!
Alternatively check out this post also.