Câu hỏi phỏng vấn Android
Câu hỏi

Mention the difference between RelativeLayout and LinearLayout ?

Câu trả lời

The main differences between RelativeLayout and LinearLayout in Android are:

  1. Positioning:
  • LinearLayout arranges views linearly in a horizontal or vertical orientation[1][2][5].
  • RelativeLayout allows positioning views relative to each other (e.g. to the left/right of, above/below another view) or the parent layout[1][2][5].
  1. Attributes:
  • LinearLayout uses attributes like layout_weight to specify relative sizes of views[1][5].
  • RelativeLayout uses attributes like layout_toRightOf, layout_below, layout_alignParentTop to position views[1][5].
  1. Complexity:
  • LinearLayout is simpler to use as it arranges views in a linear fashion[1][3].
  • RelativeLayout is more complex but provides more flexibility in positioning views[1][3].
  1. Performance:
  • LinearLayout has better performance, especially when the layout has many views, as it requires less internal view enumeration compared to RelativeLayout[3].
  • The more views a layout has, the more advantageous it is to use LinearLa...
entry

entry

Gợi ý câu hỏi phỏng vấn

junior

How to persist data in an Android app?

senior

How to avoid reverse engineering of an APK file?

junior

Tell about Constraint Layout

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào