Adjust BitmapFields Width in HorizontalFieldManager according device width - blackberry

I am new in BB development,
Please suggest me how i can adjust BitmapFields Width which are in HorizontalFieldManager
to adjust it in Device width.
I am overriding Sublayout method to get this
Now it look like this....I am getting expected o/p for Simulator 9550
Thanks

Create a customBitmapField class which extends BitmapField. Override getPreferredWidth() method and return (Display.getWidth()/3) so the bitmapfield takes up a third of the device display. you will have to handle how it looks in smaller devices as well as the text might not fit.

you can use the PillButtonSet component, you can find it in the advanced UI package.
see here: Advanced UI

Related

Static width in text field

please how can i have a static width for my Text Fields.
I have a Login View Controller (portrait) in which i have an image (logo of the App), username text field, password text field and a button to log in.
When i run it in an Iphone it looks pretty good, but in Ipad all looks stretched.
What can i do so this elements looks the same in both devices? (i want them to look as the Iphone shows).
I don't want them to resize.
Thanks a lot!
If you want an element to be an exact size you would update the width and height constraints to be your desired number.
Set your textFields width and height properties to your desired size in Attributes inspector panel or do it programmatically.
I would recommend you to use Auto Layout as that will help you make your design beautiful in all resolutions and sizes.
Thanks all for your answer, i erase the "Leading space to container" and "Trailing space to container" in each one of the elements.
It is no resizing anymore :)

Size class does not works

I need to create an app with adaptive UI. for that I use auto layout and size class. but i can't get the expected result. it displays different UIs for different screen sizes. kindly guide me to create the adaptive UI(for all screen sizes). Thanks in advance.
This is indeed problem with constraints as mentioned in comments to your question. Using size classes only allows you to set constraints for all iphones at lowest level (that's why screen size for size class Compact x Regular is same for all iphones in xcode).
It is difficult to help you, without knowing all of your constraints. My advice is, use Preview assistant, where you can see all of your devices and generated UI. By opening this Preview assistant, tap on bottom "+" symbol and add device you wish to inspect.
As you can see on this screenshot, in my storyboard, there are margins around the middle view, however on iPhone 4, where width is smaller, these margins are lower (they have lower priority as constraint), while view retains it's width/height.

UILabel doesn't show text properly

I have UILabel in interface builder like this (creating text and use Cmd + =)
but when i run the program on emulator or real device, it looks like this
the answer from here can solve my issue but it isn't the best way because i don't want to create all my label as an IBOutlet for calling sizeToFit and i also don't want to scale down my text.
is there any way to display text in the device as it shows in interface builder without additional code or configuration?
Thanks
If you're just strictly not wanting to do any of it in code, simply press Editor -> Size to Fit Content when you have the label selected in IB.
Select your label in the interface builder, and then in the utility area found on the right hand side, go to the "Size Inspector", look for this icon -->
In there you will see options to set your label's origin, width and height
Increase the "width" of your label and that should fix your problem

How to increase horizontalfieldmanager height dynamically in Blackberry?

I have added RichTextField to HorizontalFieldManager, and I also set Background bitmap to HorizontalFieldmanager. If the richtextfield text increases the horizontalfield manager height, how can I increase height dynamically?
A HorizontalFieldManager by default will increase its size to show whatever fields you have placed inside of it.
If this is not the case then it sounds like you have overridden this behavior. Without seeing code I can only guess, E.g. by using a static height or width in the sublayout.

Dynamic Editfield

I have EditField and use background image..i want to create dynamic EditField
so i want to dynamic height EditFieldbut fix width
Take a look at http://us.blackberry.com/devjournals/resources/journals/jul_2005/creating_textbox_field.jsp, it provides details on creating one.

Resources