自动引流推广app,优化算法分类,深圳优化服务,小程序开发软件有哪些LinearLayout#xff1a;相当于Java GUI中的FlowLayout#xff08;流式布局#xff09;#xff0c;就是说一个组件后边跟一个#xff0c;挨着靠#xff0c;一个组件把一行占满了#xff0c;就靠到下一行。 linearlayoutdemo.xml LinearLayout xmlns:androidht… LinearLayout相当于Java GUI中的FlowLayout流式布局就是说一个组件后边跟一个挨着靠一个组件把一行占满了就靠到下一行。 linearlayoutdemo.xml LinearLayout xmlns:androidhttp://schemas.android.com/apk/res/androidxmlns:toolshttp://schemas.android.com/tools android:idid/L1 android:layout_widthfill_parent android:layout_heightfill_parent android:orientationvertical tools:context.MainActivity TextView android:idid/tv android:layout_widthfill_parent android:layout_heightfill_parent android:layout_weight3 android:background#ffffb859 android:gravitycenter android:textstring/ll android:textSize20sp / LinearLayout android:idid/L21 android:layout_widthfill_parent android:layout_heightfill_parent android:layout_weight1 android:orientationhorizontal TextView android:idid/tv2 android:layout_widthwrap_content android:layout_heightfill_parent android:layout_weight1 android:background#ff3fb200 / TextView android:idid/tv3 android:layout_widthwrap_content android:layout_heightfill_parent android:layout_weight2 android:background#ff3436b2 / TextView android:idid/tv5 android:layout_widthwrap_content android:layout_heightfill_parent android:layout_weight3 android:background#ff7a75b2 / LinearLayout android:idid/L27 android:layout_widthwrap_content android:layout_heightfill_parent android:layout_weight6 android:orientationvertical LinearLayout android:idid/L37 android:layout_widthfill_parent android:layout_heightfill_parent android:layout_weight2 android:background#ff44ff16 android:orientationhorizontal /LinearLayout LinearLayout android:idid/L32 android:layout_widthfill_parent android:layout_heightfill_parent android:layout_weight1 android:background#ff382aff android:gravitycenter android:orientationhorizontal /LinearLayout /LinearLayout /LinearLayout /LinearLayout 效果 AbsolutelyLayout:绝对布局相当于Java GUI中的空布局就是啥也没有。组件的位置需要用坐标来显示。但是在android2.3之后已经弃用了这种布局不能适应多种屏幕尺寸局限性太大但是对于独立开发者单人单机来讲用用也无妨。 absolutelayoutdemo.xml AbsoluteLayout xmlns:androidhttp://schemas.android.com/apk/res/androidandroid:layout_widthmatch_parent android:layout_heightmatch_parent android:background#00ffff Button android:idid/er android:layout_widthwrap_content android:layout_heightwrap_content android:layout_x50dp android:layout_y50dp android:background#ff00ff android:textstring/al / /AbsoluteLayout 效果 FrameLayout这种布局是一层叠着一层游戏类应用常会使用涉及到NPC的构建视图等。 framelayoutdemo.xml FrameLayout xmlns:androidhttp://schemas.android.com/apk/res/androidandroid:layout_widthmatch_parent android:layout_heightmatch_parent android:background#000000 TextView android:layout_widthwrap_content android:layout_heightwrap_content android:textstring/fl android:textColor#ffff2f25 android:textSize40sp / TextView android:layout_widthwrap_content android:layout_heightwrap_content android:textstring/fl android:textColor#ff7e66ff android:textSize70sp / TextView android:layout_widthwrap_content android:layout_heightwrap_content android:textstring/fl android:textColor#ff5eff4f android:textSize50sp / /FrameLayout 效果 RelativeLayout关系布局顾名思义就是靠关系谁在谁的左边谁在谁的上边谁前边和谁对其等等。属性这里就不赘述了需要时查API即可。 relativelayoutdemo.xml RelativeLayout xmlns:androidhttp://schemas.android.com/apk/res/androidandroid:layout_widthmatch_parent android:layout_heightmatch_parent TextView android:idid/t1 android:layout_widthwrap_content android:layout_heightwrap_content android:layout_centerInParenttrue android:background#009922 android:textstring/rl android:textSize40sp / TextView android:idid/t2 android:layout_widthwrap_content android:layout_heightwrap_content android:layout_belowid/t1 android:background#ff8800 android:textstring/rl android:textSize40sp / /RelativeLayout 效果 GridLayout网格布局自定义N x N可拓展到屏幕外围猜想当某些游戏应用的地图大于手机屏幕时可以使用此种布局一张图片太大可以用多张图片进行拼接内嵌FrameLayout实现NPC在地图上。 gridlayoutdemo.xml ?xml version1.0 encodingutf-8?
GridLayout xmlns:androidhttp://schemas.android.com/apk/res/android android:layout_widthwrap_content android:layout_heightwrap_content android:columnCount6 android:orientationhorizontal android:rowCount10 Button android:background#ffff5651 / Button android:background#ff45ff61 / Button android:background#ff5d59ff / Button android:background#fff9ff52 / Button android:background#ff31fff0 / Button android:background#ffff5651 / Button android:background#ff45ff61 / Button android:background#ff5d59ff / Button android:background#fff9ff52 / Button android:background#ff31fff0 / Button android:background#ffff5651 / Button android:background#ff45ff61 / Button android:background#ff5d59ff / Button android:background#fff9ff52 / Button android:background#ff31fff0 / Button android:background#ffff5651 / Button android:background#ff45ff61 / Button android:background#ff5d59ff / Button android:background#fff9ff52 / Button android:background#ff31fff0 / Button android:background#ffff5651 / Button android:background#ff45ff61 / Button android:background#ff5d59ff / Button android:background#fff9ff52 / Button android:background#ff31fff0 / Button android:background#ffff5651 / Button android:background#ff45ff61 / Button android:background#ff5d59ff / Button android:background#fff9ff52 / Button android:background#ff31fff0 / Button android:background#ffff5651 / Button android:background#ff45ff61 / Button android:background#ff5d59ff / Button android:background#fff9ff52 / Button android:background#ff31fff0 / Button android:background#ffff5651 / Button android:background#ff45ff61 / Button android:background#ff5d59ff / Button android:background#fff9ff52 / Button android:background#ff31fff0 / Button android:background#ffff5651 / Button android:background#ff45ff61 / Button android:background#ff5d59ff / Button android:background#fff9ff52 / Button android:background#ff31fff0 / Button android:background#ffff5651 /