How to increase horizontalfieldmanager height dynamically in Blackberry? - 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.

Related

UILabel height depending on font size

I am using a UILabel in a UITableViewCell to display a title. Normally the text is not too long and therefore the font size can be large. Notice how the text fills the height of theUILabel like normal.
However, when there is a larger title, I want the UILabel height to reduce to accommodate the smaller font size and not leave a blank gap in its place. Currently, my configuration produces this effect.
I am using constraints in my storyboard and have deliberately not set a fixed height constraint. Here are the relevant constraints added:
I may have made a rookie error in my configuration as I can't remember this effect happening before, but it is giving me real headaches (and a bad looking UI).
When UILabel is set to auto-adjust font size to fit, it does NOT auto-adjust the height of itself.
You have a couple options:
set Baseline to Align Centers, and just accept that you will have top and bottom padding
use code to calculate the "scaled font size" and update the font size of the label
Remove either the Top Space or Bottom Space constraints (depending on where you want the label to be anchored).
This will cause the label to automatically use fit itself to the text size.
Try this and see, it should work according to your need:
Set Top and Bottom constraints attribute Greater Than or Equal To and add horizontal center (Alight Center Y to superview) and show in this image.

How to make custom implemented textView supporting AutoLayout?

I create a custom textview (subclass of UIView, draw text with TextKit). I want to make the textview work with AutoLayout, i.e. I set the left and right margin, then it calculate the height itself automatically.
I think I should override the intrinsicContentSize size, but this function have no input. Height cannot be calculated without the constrained width.
I try to override sizeThatFits, which have an constrained size that I want, but it doesn't be called when using AutoLayout.
This intrinsic size must be independent of the content frame, because there’s no way to dynamically communicate a changed width to the layout system based on a changed height, for example.(from documentation)
In your case I'd try to add a height constraint manually inside your custom textView and set its value when you calculate size based on text

determining height to be set based on font size in iOS

In IOS, we have height and font size for UI label.
When I add a uilabel to the screen, I see a default height and font for it and height is always bit more than the font size to take care of ascenders and descenders. But when I increase the font size in design time, the height still remains at where it was when it was added to the screen. So, how to I decide during design time what is the appropriate height to be set if I change the font size to what I want.
Edit the text of the label and press enter, it will take it's size
Click your label in the canvas so that you get its resize handles. Then, from the menu bar, choose Editor > Size to Fit Content. The default shortcut is ⌘=.

Adjust BitmapFields Width in HorizontalFieldManager according device width

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

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