zoukankan      html  css  js  c++  java
  • Android Studio之菜单栏制作 (一)

    静态菜单栏XML文件准备工作

    一、准备好布局首页展示页面XML文件

    该布局文件适应于三种菜单栏。

    此处说明一下菜单栏的种类:选项菜单(也称三点菜单键)、上下文菜单(长按菜单)、弹出式菜单(点击菜单)

    代码如下:

    <?xml version="1.0" encoding="utf-8"?>
    <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".MainActivity">
    
        <TextView
            android:id="@+id/textView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="山有木兮木有枝,心悦君兮君不知"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintVertical_bias="0.242" />
    
        <Button
            android:id="@+id/button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="选项一"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.69"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/textView"
            app:layout_constraintVertical_bias="0.254" />
    
        <Button
            android:id="@+id/button2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="选项二"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintHorizontal_bias="0.309"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/textView"
            app:layout_constraintVertical_bias="0.252" />
    
    </androidx.constraintlayout.widget.ConstraintLayout>
  • 相关阅读:
    MySQL表行数查询最佳实践
    mysqldump备份表中有大字段失败的排错过程
    μC/OSⅡ在C8051F060上的移植及其应用
    OSSchedLock()函数透析
    32位与64位区别
    【Cesium】Animation显示系统时间
    【Cesium】根据经纬度计算距离
    【Cesium】 鼠标拾取椭球、地形、模型坐标点(经度+纬度+高程)
    【Python学习】Selenium模拟浏览器抓取数据
    【Cesium】polygon中的height和extrudedHeight的区别
  • 原文地址:https://www.cnblogs.com/wangdayang/p/14912456.html
Copyright © 2011-2022 走看看