鸿蒙 UI控件分为Component 和 ComponentContainer,类似Android里面的View和ViewGroup
- Component:是界面中所有组件的基类,如 Text、Image 等
- ComponentContainer:标准布局功能的容器的基类。如 DirectionalLayout、DependentLayout 等。DirectionalLayout类似Android的LinearLayout,DependentLayout类似Android的RelativeLayout
另外鸿蒙大小单位有三种px、fp、vp
px:像素
vp:以屏幕相对像素为单位,也就是安卓中的dp
fp:相当于sp
控件API
命名:$+id:
match_content等价于Android wrop_parent
match_parent与Android一致
text 与Android一致
text_size 与Android一致
text_color 与Android一致
padding 与Android一致
top_margin 等价于Android margin_top
background_element 等价于Android的background
其他API后续再补充。
页面布局
DirectionalLayout
DirectionalLayout