简体   繁体   中英

Few questions about android's screen orientation

I write a rectangle widget.

After writing its portrait XML, I want to write its landscape.

  1. I should change any LinearLayout orientation from horizontal to vertical?

    horizontal is right to left (not top to bottom) relative to the screen in origin portrait mode?

  2. If i don't mention layout_height property, what is the default? ( match parent? )

  3. how does weight property take effect when I specify layout_width = X dip ?

    when I specify layout_width = wrap_content ?

  4. what does fill_parent mean when in top-most LinearLayout ?

1a) No, you should not.

1b) Horizontal is left to right relative to the screen in origin portrait mode.

2) There is no default value, you have to set it (other time you will see an error)

3) Please look at that question

4) The view should be as big as its parent (minus padding)

To give the task of managing screen orientation to Android on behalf, you don't need to think all this stuff. Just mention android:configChanges="orientation|keyboardHidden|screenSize|screenLayout" in your activity from AndroidManifest.xml

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM