sorry for my question, but I'm android beginner :-)
I need help just with create layout, some best practices for my solution.
My requested layout must be on the screen splitted to 3 parts:
header as expander - if possible
fix size (height 200px / width fill) of the screen - if expanded
linear layout - horizontal with 3 rows of labels
only first label is visible if expander is collapsed
top of screen
body
dynamically resize (height fill place between header and footer / width fill)
scrollable vertical
horizontal will change body with another (not necessary now)
in body will be two level list - headers as parent, expandable to child
List item
fix size (height 200px / width fill) of the screen
linear layout - vertical (with 4 images icons)
bottom of screen
My basic problem is how create basic layout (header / body / footer) as panels in whitch I can add next controls.
Create it as linear layout?? How correct fix it on the screen? What header as expander?
Related
I have a view with the following layout:
[Image] [button1] [label1] [button2]
[label2]
button1 & button2 should grow and shrink based on how long the text will be, label1 will always contain the same text so it doesn't need to adjust just align with the buttons that will.
my iOS skills aren't very sharp (I'm more of an android dev) so I'm not sure how I achieve this.
You can try adding these horizontal constraints:
Left Margin for image.
Fixed width constraint for image.
Right margin from the image to the button.
Right margin from button1 to label1. Then set that to 'more than or equal' like maybe 20pts. This means the spacing will always adjust itself to be as large as possible without going off screen (width autoresized to fit text).
Fixed width for label1.
Left margin from button2 to label1.
Right margin from button2 to superview. Then set that to 'more than or equal' like maybe 20pts. This means the spacing will always adjust itself to be as large as possible without going off screen (width autoresized to fit text).
More on constraints :
Apple developer autolayout
Raywenderlich adaptive layout
I am having problem in resizing views according to screen size changes in android studio. I have 3 image buttons adjacent to each other and I want their combined width to fill width of screen. I know that match_parent can fill the screen size but this case is different. I want each button of width as 1/3 size of screen. How can I do this?
Assuming these 3 buttons are located inside a horizontal <LinearLayout> add these tags to each button layout_width="0dp" and layout_weight="1"
I'm using the Java Scene Builder 2.0 to create a GUI that uses the tab pane. I've added an Imageview to each tab so I can give them icons instead of text. I set the tabs minimum width and height to 100x100 and they adjust to that size. When I add an imageview to the tab I'm making it's minimum width and height 100x100 but it shrinks the tab size and only shows a part of the icon. This happens when the imageview has a picture and when it doesn't so I don't think it's a problem with the size of the picture.
You can see from this picture the first tab from the left doesn't have an imageview and is the size I want the tabs to be. The second tab has an empty image view and the rest of the tabs have images. I would like the images to be 100x100 and fit in the tabs.
A Java Scene Builder solution is prefered but I will also gladly accept a code solution.
I solved the problem it was something simple. In the tab pane Layout settings I only changed the min height/width to 100x100 but I left the max height/width to the default which was 1.7976931348623157E308. I didn't notice that number was so small at first and I changed it to 200. Now the images display better.
I have an iPhone app that will only ever be in Portrait view.
I have a number of buttons etc. on my layout. However, when I switch between iPhone 4 and iPhone 5 sizes, I need the bottom image to "stick" to the bottom. The rest of the images and buttons can stay where they are. I just need to bottom white image to look like a footer.
Can anyone please tell me how to do this?
I have tried using constraint (Pin) and set the bottom margin value to 0 but this simply stretched the bottom white image across the entire View.
Below are 2 screen grabs of how the layouts appear for both iPhone 4 and 5 (this is taken in Storyboard)
iPhone 4
And iPhone 5
You can just add a constraint to the bottom layout guide and set it to zero.
From your storyboard/xib, place the view at the bottom of the container, drag&drop from the view to the view itself but be sure to dragging downward. Then select "Bottom Space to Bottom Layout Guide". Now your view is fixed at this distance from the bottom of the main view.
You obviously have to set up the other constraints for the white view (width, height and horizontal position).
I tried one by one each of these methods : setting the BgAlign property to CENTER in the Resource Editor , myLabel.getStyle().setBackgroundAlignment(Style.BACKGROUND_IMAGE_ALIGN_CENTER); but the text of the Label is not centered vertically.
So how to make Label's text centered vertically ?
The following image shows the actual alignement of the Label's text :
Label vertical alignment is unsupported only its positioning in relation to an icon.
As far as I recall you are using FlowLayout for every entry which does support vertical alignment see FlowLayout.setValign(Component.CENTER).