BlackBerry - What returns getPreferredWidth () and getPreferredHeight ()?

I do not understand the concept of the getPreferredWidth () and getPreferredHeight () methods. What they return means on what basis the values ​​are returned.

What is the difference between getWidth () and getPreferredWidth () ???

Thank..

+3
source share
2 answers

By default, the # getPreferredHeight () field and the # getPreferredWidth () field return 0. They are designed to override your custom fields with any of your preferred field widths and heights.

, , . , . - .

# getHeight() # getWidth(), , .

+6

# getPreferredWidth() . , . # getWidth() , . # getWidth() , . , .

getPreferredWidth() , ButtonField.

    ButtonField myButton = new ButtonField("Click", USE_ALL_WIDTH){
        public int getPreferredWidth(){
            return Display.getWidth();
        }
    };
-2

Source: https://habr.com/ru/post/1731834/


All Articles