[android] 优酷环形菜单-相对布局练习详解手机开发
2023-06-13 09:20:13 时间
优酷环形菜单
布局文件,使用 RelativeLayout/ 控件作为第一级菜单,相对布局,位于父控件的底部,水平居中,因为图片不是特别的标准,因此宽度和高度都钉死,宽度是高度的两倍
二次菜单和三级菜单都一样的布局
小房子的图标 imageView/ 控件,在父控件中居中
第二级搜索图标,位于父控件的底部,上下左右maigin10dp
第二级菜单图标,位于父控件的顶部,水平居中,marginTop 10dp
第二级叹号图标,位于父控件的底部,右边,margin 10dp
第三级的图标比较多,但是原理和第二级一样,只不过通过margin来定位
第三级channel2的图标,位于channel1图标的上面,和channel1左边对齐,marginLeft 20dp,marginBottom 6dp
第三级channel3的图标,位于channel2图标的上面,和channel2左边对齐,marginLeft 30dp,marginBottom 6dp
第三级channel4的图标,位于父控件的上面,水平居中,marginTop 5dp
左侧半圆结束,右侧半圆和左侧一样的步骤
布局代码:
RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="${relativePackage}.${activityClass}" RelativeLayout android:layout_width="100dp" android:layout_height="50dp" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:background="@drawable/level1" ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:background="@drawable/icon_home" / /RelativeLayout RelativeLayout android:layout_width="180dp" android:layout_height="90dp" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:background="@drawable/level2" ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_margin="10dp" android:background="@drawable/icon_search" / ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_marginTop="5dp" android:background="@drawable/icon_menu" / ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:layout_margin="10dp" android:background="@drawable/icon_myyouku" / /RelativeLayout RelativeLayout android:layout_width="280dp" android:layout_height="140dp" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:background="@drawable/level3" ImageView android:id="@+id/channel1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_marginBottom="10dp" android:layout_marginLeft="10dp" android:background="@drawable/channel1" / ImageView android:id="@+id/channel2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@id/channel1" android:layout_alignLeft="@id/channel1" android:layout_marginBottom="10dp" android:layout_marginLeft="20dp" android:background="@drawable/channel2" / ImageView android:id="@+id/channel3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@id/channel2" android:layout_alignLeft="@id/channel2" android:layout_marginBottom="10dp" android:layout_marginLeft="34dp" android:background="@drawable/channel3" / ImageView android:id="@+id/channel4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="5dp" android:layout_centerHorizontal="true" android:background="@drawable/channel4" / ImageView android:id="@+id/channel7" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:layout_marginBottom="10dp" android:layout_marginRight="10dp" android:background="@drawable/channel7" / ImageView android:id="@+id/channel6" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@id/channel7" android:layout_alignRight="@id/channel7" android:layout_marginBottom="10dp" android:layout_marginRight="20dp" android:background="@drawable/channel6" / ImageView android:id="@+id/channel5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@id/channel6" android:layout_alignRight="@id/channel6" android:layout_marginBottom="10dp" android:layout_marginRight="34dp" android:background="@drawable/channel5" / /RelativeLayout /RelativeLayout
5406.html
app程序应用开发手机开发无线开发移动端开发相关文章
- 基于chromium for android开发Android浏览器
- android onresume方法,Android onActivityResult()和onResume()的执行顺序
- android线程间通信的几种方法_Android进程间和线程间通信方式
- mitmproxy 抓包神器-2.抓取Android 和 iOS 手机 https 请求
- 【Android 屏幕适配】屏幕适配基础概念 ④ ( 屏幕适配限定符 | 手机/平板电脑设备屏幕适配 )
- 【Android 屏幕适配】异形屏适配 ① ( 异形屏类型:刘海屏、水滴屏、挖孔屏 | 沉浸式布局刘海屏适配 | 华为手机异形屏适配注意点 )
- Android ConstraintLayout按比例缩放View详解手机开发
- Android Proximity Sensor近距离传感器P-Sensor详解手机开发
- Android TextView图文混合编排详解手机开发
- Android桌面小部件AppWidget(2)详解手机开发
- Android选择本地图片并裁剪工具类详解手机开发
- [android] 界面切换的核心方法详解手机开发
- [android] android项目架构详解手机开发
- [android] 手机卫士黑名单功能(列表展示)详解手机开发
- [android] 轮播图-滑动图片标题焦点详解手机开发
- [android] 手机卫士输入框抖动和手机震动详解手机开发
- [android]android下apk的安装过程详解手机开发
- android 减少图片出现oom错误详解手机开发
- Android Studio安装插件Genymotion详解手机开发
- android fragement报nullexcption错误详解手机开发
- Android基础知识回顾详解手机开发
- Android学习(一)详解手机开发
- Android Call(打电话)的基本知识详解手机开发
- Android Studio离线安装Android Size Analyzer(非build下analyze apk)详解手机开发
- Android 屏幕刷新机制:ViewRootImpl、Choreographer、Surface、SurfaceFlinger关系详解手机开发
- win10 编译 Android ffmpeg详解手机开发
- 独家报道:Realme Flash是首款采用磁性无线充电的Android手机