Android开发学习【简单控件】

2023-11-05

Android onCreate 详解

public class MainActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}

此处进行简要介绍,详细请点击Android onCreate 详解
一、 super.onCreate(savedInstanceState)
其中super.onCreate(savedInstanceState)的作用是调用其父类Activity的onCreate方法来实现对界面的图画绘制工作。
在实现自己定义的Activity子类的onCreate方法时一定要记得调用该方法,以确保能够绘制界面。
二、setContentView(R.layout.caculator_layout)
作用:加载一个界面。
该方法中传入的参数是”R.layout.caculator_layout“,其含义为R.java类中静态内部类layout的静态常量caculator_layout的值,
而该值是一个指向res目录下的layout子目录下的caculator_layout.xml文件的标识符。因此代表着显示caculator_layout.xml所定义的画面。

简单控件

在这里插入图片描述

文本显示

设置文本内容方式

设置文本内容有两种方式:
·在 XML 文件中通过属性 android:text 设置文本

<resources>
    <string name="app_name">Study01</string>
    <string name="hello">你好,世界!</string>
</resources>
android:text="Hello World!"//直接设置
or
android:text="@string/hello" //引用string里面设置的常量

·在 Java 代码中调用文本视图对象的 setText

<TextView
        android:id="@+id/tv_hello"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello"/>

通过java代码设置文本内容

protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_text_view);
        TextView tv_hello = findViewById(R.id.tv_hello);
        tv_hello.setText("你好世界");
    }

设置文本的大小

在 Java 代码中调用 setTextSize 方法,即可指定文本大小。
在 XML 文件中则通过属性 android:textSize 指定文本大小,此时需要指定字号单位。
px:它是手机屏幕的最小显示单位,与设备的显示屏有关。
dp:它是与设备无关的显示单位,只与屏幕的尺寸有关。
sp:它专门用来设置字体大小,在系统设置中可以调整字体大小/(追随系统)

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello"
        android:textSize="30px"/>
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello"
        android:textSize="30dp"/>
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello"
        android:textSize="30sp"/>

设置文本的颜色

在 Java 代码中调用 setTextColor 方法即可设置文本颜色,具体色值可从 Color 类
在这里插入图片描述

protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_color_view);
        TextView tv_hello_color = findViewById(R.id.tv_hello_color);
        tv_hello_color.setTextColor(Color.GREEN);
    }

也次从color.xml中获取 例如:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="purple_200">#FFBB86FC</color>
    <color name="purple_500">#FF6200EE</color>
    <color name="purple_700">#FF3700B3</color>
    <color name="teal_200">#FF03DAC5</color>
    <color name="teal_700">#FF018786</color>
    <color name="black">#FF000000</color>
    <color name="white">#FFFFFFFF</color>
</resources>
<TextView
        android:id="@+id/tv_hello_color"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/hello"
        android:textColor="@color/black"/>

设置视图的宽高

直接设置

视图宽度通过属性android:layout_width表达,视图高度通过属性android:layout_height表达,宽高的取值主要有下列三种:
match_parent:表示与上级视图保持一致。
wrap_content:表示与内容自适应
以dp为单位的具体尺寸。

<TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:background="#00ffff"
        android:text="设置视图的宽高"
        android:textSize="10dp"/>
<TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:background="#00ffff"
        android:text="设置视图的宽高"
        android:textSize="10dp"/>

在这里插入图片描述

在代码中设置视图宽高

首先确保XML中的宽高属性值为wrap_content,接着打开该页面对应的Java代码,依序执行以下三个步骤:
调用控件对象的getLayoutParams方法,获取该控件的布局参数。
布局参数的width属性表示宽度,height属性表示高度,修改这两个属性值。
调用控件对象的setLayoutParams方法,填入修改后的布局参数使之生效。

public class ViewBorderActivity extends AppCompatActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_view_border);
        TextView tv_code = findViewById(R.id.tv_code);
        //获取tv_code的布局参数(含宽度和高度)
        ViewGroup.LayoutParams params = tv_code.getLayoutParams();
        //修改布局参数,注意默认px单位
        params.height=300;
        params.width=300;
        tv_code.setLayoutParams(params);
    }
}

<TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:background="#00ffff"
        android:text="设置视图的宽高"
        android:textSize="10dp"/>
    <TextView
        android:layout_width="300dp"
        android:layout_height="300dp"
        android:layout_marginTop="5dp"
        android:background="#00ffff"
        android:text="设置视图的宽高"
        android:textSize="10dp"/>
    <TextView
        android:id="@+id/tv_code"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:background="#00ffff"
        android:text="通过代码设置视图的宽高"
        android:textSize="10dp"/>

在这里插入图片描述

设置视图间距

采用layout_margin属性,它指定了当前视图与周围平级视图之间的距离/(外边距)。包括layout_margin、layout_marginLeft、layout_marginTop、layout_marginRight、layout_marginBottom
采用padding属性,它指定了当前视图与内部下级视图之间的距离/(内边距)。包括padding、paddingLeft、paddingTop、paddingRight、paddingBottom

<LinearLayout 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=".ViewMarginActivity">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:padding="60dp"
        android:background="@color/teal_200"
        android:orientation="vertical">
        <View
            android:layout_width="match_parent"
            android:layout_height="300dp"
            android:layout_margin="20dp"
            android:background="@color/teal_700"/>
        <View
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/white"/>
    </LinearLayout>

</LinearLayout>

在这里插入图片描述

设置视图的对齐方式

设置视图的对齐方式有两种途径:
采用layout_gravity属性,它指定了当前视图相对于上级视图的对齐方式。
采用gravity属性,它指定了下级视图相对于当前视图的对齐方式。
layout_gravity与gravity的取值包括:left、top、right、bottom,还可以用竖线连接各
取值,例如“left|top”表示即靠左又靠上,也就是朝左上角对齐。
在这里插入图片描述

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="400dp"
    android:orientation="horizontal">
    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="200dp"
        android:layout_weight="1"
        android:background="@color/red"
        android:layout_margin="10dp"
        android:padding="10dp"
        android:layout_gravity="bottom"
        android:gravity="right|top">
        <View
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:background="@color/teal_200"/>
    </LinearLayout>
    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="200dp"
        android:layout_weight="1"
        android:background="@color/red"
        android:layout_margin="10dp"
        android:padding="10dp"
        android:layout_gravity="top"
        android:gravity="left|bottom">
        <View
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:background="@color/teal_200" />
    </LinearLayout>

</LinearLayout>

线性布局LinearLayout

线性布局内部的各视图的两种排列方式

orientation属性值为horizontal时,内部视图在水平方向从左往右排列。
orientation属性值为vertical时,内部视图在垂直方向从上往下排列。
如果不指定orientation属性,则LinearLayout默认水平方向排列。

线性布局的权重

线性布局的权重概念,指的是线性布局的下级视图各自拥有多大比例的宽高。
权重属性名叫layout_weight,但该属性不在LinearLayout节点设置,而在线性布局的直
接下级视图设置,表示该下级视图占据的宽高比例。
layout_width填0dp时,layout_weight表示水平方向的宽度比例。
layout_height填0dp时,layout_weight表示垂直方向的高度比例。
layout_weight所代表的值->相当于占总和的百分比

在这里插入图片描述

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">
        <TextView
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:textSize="17sp"
            android:background="@color/teal_200"
            android:text="水平方向第一个单元"/>
        <TextView
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:textSize="17sp"
            android:background="@color/teal_200"
            android:text="水平方向第二个单元"/>

    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">
        <TextView
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:textSize="17sp"
            android:background="@color/teal_700"
            android:text="竖直方向第一个单元"/>
        <TextView
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"

            android:textSize="17sp"
            android:background="@color/teal_700"
            android:text="竖直方向第二个单元"/>

    </LinearLayout>

</LinearLayout>

相对布局RelativeLayout

相对布局的下级视图位置由其他视图决定。用于确定下级视图位置的参照物分两种:
与该视图自身平级的视图;
该视图的上级视图(也就是它归属的RelativeLayout)
如果不设定下级视图的参照物,那么下级视图默认显示在RelativeLayout内部的左上角。

相对位置的取值

在这里插入图片描述
在这里插入图片描述

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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="400dp">
    <TextView
        android:id="@+id/pos_mid"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="中间"
        android:layout_centerInParent="true"
        android:textColor="@color/black"
        android:textSize="17sp"/>
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="水平居中"
        android:layout_centerHorizontal="true"
        android:textColor="@color/black"
        android:textSize="17sp"/>
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="垂直居中"
        android:textSize="17sp"
        android:textColor="@color/black"
        android:layout_centerVertical="true"/>
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="左侧对齐"
        android:textSize="17sp"
        android:textColor="@color/black"
        android:layout_alignParentLeft="true"/>
    <TextView
        android:id="@+id/pos_right"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="右侧对齐"
        android:textSize="17sp"
        android:textColor="@color/black"
        android:layout_alignParentRight="true"/>
    <TextView
        android:id="@+id/bottom"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="底部"
        android:textSize="17sp"
        android:textColor="@color/black"
        android:layout_alignParentBottom="true"/>
    <TextView
        android:id="@+id/pos_mid_right"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="右侧中间"
        android:layout_centerVertical="true"
        android:layout_alignRight="@id/pos_right"
        android:textSize="17sp"
        android:textColor="@color/black" />
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="底部中间"
        android:layout_alignLeft="@id/pos_mid"
        android:layout_alignParentBottom="true"
        android:textSize="17sp"
        android:textColor="@color/black" />
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="底部右侧"
        android:layout_alignLeft="@id/pos_mid_right"
        android:layout_alignParentBottom="true"
        android:textSize="17sp"
        android:textColor="@color/black" />
</RelativeLayout>

网格布局GridLayout

网格布局支持多行多列的表格排列。
网格布局默认从左往右、从上到下排列,它新增了两个属性:
columnCount属性,它指定了网格的列数,即每行能放多少个视图;
rowCount属性,它指定了网格的行数,即每列能放多少个视图;

网格布局的权重

使用app:layout_columnWeight 和app:layout_rowWeight 设置权重

例如:在这里插入图片描述

<?xml version="1.0" encoding="utf-8"?>
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:columnCount="2"
    android:rowCount="2">
    <TextView
        android:layout_width="0dp"
        android:layout_height="60dp"
        android:layout_columnWeight="1"
        android:text="浅红色"
        android:gravity="center"
        android:textColor="@color/black"
        android:background="#ffcccc"
        android:textSize="17sp"/>
    <TextView
        android:layout_width="0dp"
        android:layout_height="60dp"
        android:layout_columnWeight="1"
        android:gravity="center"
        android:text="橙色"
        android:textColor="@color/black"
        android:background="#ffaa00"
        android:textSize="17sp"/>
    <TextView
        android:layout_width="0dp"
        android:layout_height="60dp"
        android:layout_columnWeight="1"
        android:gravity="center"
        android:text="绿色"
        android:textColor="@color/black"
        android:background="#00ff00"
        android:textSize="17sp"/>
    <TextView
        android:layout_width="0dp"
        android:layout_height="60dp"
        android:layout_columnWeight="1"
        android:layout_colWeight="1"
        android:gravity="center"
        android:text="深紫色"
        android:textColor="@color/black"
        android:background="#660066"
        android:textSize="17sp"/>

</GridLayout>

滚动视图ScrollView

两种滚动视图

ScrollView,它是垂直方向的滚动视图;垂直方向滚动时,layout_width属性值设置为match_p
arent,layout_height属性值设置为wrap_content。
HorizontalScrollView,它是水平方向的滚动视图;水平方向滚动时,layout_width属性值设置
为wrap_content,layout_height属性值设置为match_parent。
此处建议在虚拟机or实体机运行体验(个人表示体验感很爽)
在这里插入图片描述

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <HorizontalScrollView
        android:layout_width="wrap_content"
        android:layout_height="200dp">
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:orientation="horizontal">
            <View
                android:layout_width="300dp"
                android:layout_height="match_parent"
                android:background="@color/teal_200"/>
            <View
                android:layout_width="300dp"
                android:layout_height="match_parent"
                android:background="@color/teal_700"/>
        </LinearLayout>

    </HorizontalScrollView>

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:orientation="vertical">
            <TextView
                android:layout_width="match_parent"
                android:layout_height="400dp"
                android:text="1024节日快乐!"
                android:textColor="@color/black"
                android:gravity="center"
                android:textSize="17sp"
                android:background="@color/red"/>
            <View
                android:layout_width="match_parent"
                android:layout_height="400dp"
                android:background="@color/purple_200"/>
        </LinearLayout>

    </ScrollView>
</LinearLayout>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Android开发学习【简单控件】 的相关文章

  • 配置项目 ':react-native-gesture-handler' 时出现问题

    大家好 我已经尝试了很长时间来解决这个问题 但不幸的是我还没有弄清楚如何解决 希望你们能帮助我 所以我有一个反应本机项目和我的朋友 以及我的一位朋友添加 React native gesture handler 包供我们使用 他对这个包没有
  • 如何以编程方式判断蓝牙设备是否已连接?

    我了解如何获取已配对设备的列表 但如何判断它们是否已连接 这一定是可能的 因为我看到它们列在我手机的蓝牙设备列表中 并且它说明了它们的连接状态 将蓝牙权限添加到您的AndroidManifest中
  • android:ScrollView(或视差)内的RecyclerView

    我有一个片段2 次卡片浏览内有多个控件 below我有第二个卡片视图回收者视图 这有效perfect 问题是 recyclerview 启动了屏幕的最底部 并且滚动recyclerview非常small 以前使用过列表视图 这使我可以适应您
  • 与通用地图相比,MapView 的分辨率较差

    我刚刚收到 HTC Desire 进行测试 我注意到 残留在小于整个屏幕的框架中的地图视图不如通用地图应用程序那么清晰 有什么办法解决这个问题吗 您应该使用 API 级别 4 或更高级别编译应用程序 然后在 AndroidManifest
  • 如何在 Android 中创建始终位于顶部的全屏覆盖 Activity

    我希望能够创建一个始终位于 Android 显示前面的 Activity 它不应该接收任何输入 只需将其传递到其下面的任何应用程序即可 像平视显示器之类的东西 我能够研究我需要将底层窗口类型设置为 TYPE SYSTEM ALERT 但看起
  • 突出显示列表视图项目

    我需要在触摸列表视图项目时突出显示它并保持突出显示状态 我尝试了我发现的一切 但没有任何效果 这是我的代码 这是列表视图
  • 将项目添加到 android 框架的设置中

    我正在 android 框架中工作 我想向 android 操作系统中的现有设置添加一个项目 您能告诉我如何执行此操作吗 首先阅读有关偏好活动 http developer android com reference android pre
  • 通过配置更改保留 CoroutineScope 的干净方法,无需 ViewModel

    我知道建议是在我们的 Activity 中使用 ViewModel 这样我们就可以使用它viewModelScope 由于 ViewModel 的寿命比 Activity 的寿命长 因此我们不必取消以下作业activity onDestro
  • 有没有办法创建 PWA(渐进式 Web 应用程序)的 Android 桌面小部件?

    我正在构建一个渐进式 Web 应用程序 有没有办法创建 Android 桌面小部件 None
  • 如何让surfaceview透明

    大家好 我想让我的 DrawingSurface 视图透明 我尝试了很多东西 但它不起作用 这是我的 xml 代码 使我的表面视图透明
  • DialogFragment 关闭事件

    我需要处理 DialogFragment 的结尾 在调用 dismiss 之后 例如 我会在关闭后 包含 片段的活动内显示一个 toast 我该如何处理该事件 覆盖onDismiss 在你的DialogFragment中 或者使用setOn
  • Android:从 PhoneGap 应用打开 Play 商店链接

    我想从我的phonegap 3 4 应用程序打开一个指向Google Play 商店的链接 呼唤market details id com google android apps maps导致 ActivityNotFoundExcepti
  • 如何获取Android中的所有主屏幕?

    我是安卓开发新手 我知道每个主屏幕都是启动器中的一个工作区 我想获取屏幕上所有应用程序图标的所有位置信息 那么有没有办法获取这些屏幕对象及其图标信息的列表 ADD 我更期待的是应用程序图标和屏幕之间的关系 例如 我想要某个应用程序图标的位置
  • Android:选择 EditField 上焦点上的所有文本

    我试图让 Android 在获得焦点时选择 EditText 字段中的所有文本 我在布局中使用此属性 在两个字段上 android selectAllOnFocus true 我不确定这是否相关 但为了将光标移动到第一个可编辑字段 前面 还
  • 带有工具提示的搜索栏 android

    Hi All 我正在尝试使用工具提示自定义 android 搜索栏 如给定的图像 有没有办法在搜索栏中添加带有拇指的文本视图 或任何其他想法 Thanks 我们可以通过拇指的界限来做到这一点 并在seekbar的progressChange
  • 在两个片段之间拖放视图

    我目前正在尝试在两个片段之间实现拖放 我已经将它们添加到我的活动中 如下所示 FragmentManager fm getFragmentManager FragmentTransaction ft fm beginTransaction
  • 如何从另一个活动更新 Recyclerview 数据

    我有两个活动 MainActivity 和 Addlogactivity 我正在更新 Addlogactivity 中的数据 该数据应显示在 mainactivity recyclerview 中 数据未在数据库中更新 MianActivi
  • 将主题应用到 v7 支持操作栏

    我正在使用support v7库来实现ActionBar在我的应用程序中 我的styles xml file
  • Android Webview隐私浏览

    我在我的 Android 应用程序中使用 webview 从多个站点获取一些网页 我对 webview 行为有一些疑问 webview 是否存储历史记录 cookie 表单自动填充信息 如果是的话 我们可以阻止它这样做吗 如果 Webvie
  • FCM(Firebase Cloud Messaging)如何发送到所有手机?

    我创建了一个小型应用程序 能够从 FCM 控制台接收推送通知 我现在想做的是向所有使用 API 安装应用程序的 Android 手机发送推送通知 这就是我完全迷失的地方 有没有办法在不收集所有注册ID的情况下将其发送到所有手机 这是否仅适用

随机推荐

  • 图的遍历(c语言)

    文章目录 图的遍历 种类 深度优先遍历 算法实现 广度优先遍历 算法实现 图的遍历 概念 图遍历是一种用于在图中搜索顶点的技术 图的遍历也用来决定在搜索过程中访问顶点的顺序 图的遍历可以在不创建循环的情况下找到要在搜索过程中使用的边 这意味
  • HJ92 在字符串中找出连续最长的数字串

    Powered by NEFU AB IN Link 文章目录 HJ92 在字符串中找出连续最长的数字串 题意 思路 代码 HJ92 在字符串中找出连续最长的数字串 题意 输入一个字符串 返回其最长的数字子串 以及其长度 若有多个最长的数字
  • java设计模式-单例模式

    package com hcmony singleton h3 单例模式 这种有并发问题 还有很多没有写 h3 p 单例模式 Singleton Pattern 是 Java 中最简单的设计模式之一 这种类型的设计模式属于创建型模式 它提供
  • fastapi与django异步的并发对比

    概述 据说fastapi是目前最快的异步框架 遂决定将其和django异步进行并发比较 先说结果 fastapi的异步可以使整体运行速度非常均衡 不会出现较大波动 但是django会出现大量的波动问题 部分访问速度很快 但是部分访问速度很慢
  • Android — 使用recyclerview+FlexboxLayoutManager实现Tag标签

    如图实现下面流式的tag标签 我们用recyclerview flexboxLayoutManager来实现 重点 FlexboxLayoutManager layoutManager new FlexboxLayoutManager th
  • 查看系统命令

    转载来自 https blog csdn net grgary article details 50975237 Linux下如何查看计算机的配置信息 cpu物理个数 几核 2016年03月24日 21 20 41 GJoker 阅读数 1
  • 【react】虚拟dom和真实dom

    关于虚拟dom 1 本质是Object类型的对象 一般对象 2 虚拟dom比较 轻 真实dom比较 重 因为虚拟dom是react内部在用 无需真实dom上那么多的属性 3 虚拟dom最终会被react转化为真实dom 呈现在页面上
  • Android_异常大全

    java lang NullPointerException 这个异常的解释是 程序遇上了空指针 简单地说就是调用了未经初始化的对象或者是不存在的对象 这个错误经常出现在创建图片 调用数组这些操作中 比如图片未经初始化 或者图片创建时的路径
  • C语言 程序 杨辉三角实现

    9 杨辉三角形 在屏幕上显示杨辉三角形 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 问题分析与算法设计 杨辉三角形中的数 正是 x y 的N次方幂展开式各项的系数 本题作为程序设计中具有代表性的题
  • 【推荐】SpringMVC与JSON数据返回及异常处理机制的使用

    艳艳耶 个人主页 个人专栏 推荐 Spring与Mybatis集成整合 生活的理想 为了不断更新自己 1 JSON 在SpringMVC中 JSON数据返回通常是通过使用 ResponseBody 注解将Java对象转换为JSON格式 并直
  • JDBC编程

    程序运行的时候 往往需要存取数据 现代应用程序最基本 也是最广泛的数据存储就是关系数据库 Java为关系数据库定义了一套标准的访问接口 JDBC Java Database Connectivity JDBC简介 在介绍JDBC之前 先简单
  • 软件测试岗:惨不忍睹的阿里三面,幸好做足了准备,已拿30koffer

    三面大概九十分钟 问的东西很全面 需要做充足准备 就是除了概念以外问的有点懵逼了 呜呜呜 回来之后把这些题目做了一个分类并整理出答案 强迫症的我 狂补知识 分为软件测试基础 Python自动化 性能测试 安全测试等 接下来分享一下我的这阿里
  • Unity ECS记录

    参考 What are Blob Assets 参考 Converting scene data to DOTS 参考 unity dots packages 参考 unity entities package documents 前言 我
  • Onnx以及Onnx runtime

    一 ONNX简介 它是微软和Facebook提出的一种表示深度学习模型的开放格式 定义了一套独立于环境和平台的标准格式 二 ONNX作用 无论你使用什么样的训练框架来训练模型 比如TensorFlow Pytorch OneFlow Pad
  • c++基础练习题三

    1 按照商品价格降序输出商品信息 include
  • 【TensorRT】TensorRT 部署Yolov5模型(C++)

    TensorRT 部署Yolov5模型C 源码地址 1 TensorRT部署模型基本步骤 1 1 onnx模型转engine 1 2 读取本地模型 1 3 创建推理引擎 1 4 创建推理上下文 1 5 创建GPU显存缓冲区 1 6 配置输入
  • 计算机最高单价公式,CFA考试中计算器的三种最高频率的用法

    原标题 CFA考试中计算器的三种最高频率的用法 CFA考试中使用计算机的频率还是比较多的 但是你知道使用CFA考试中使用计算机最高频率的使用方法你知道吗 下边有小跃给大家分享一下在CFA考试中计算器的三种最高频的用法 CFA考试时只允许使用
  • 在OpenCV中使用Canny边缘检测

    点击上方 小白学视觉 选择加 星标 或 置顶 重磅干货 第一时间送达 边缘检测是非常常见和广泛使用的图像处理 对于许多不同的计算机视觉应用非常必要 如数据提取 图像分割 在更细粒度的特征提取和模式识别中 它降低了图像中的噪声和细节数量 但保
  • dos进入mysql不记得密码_windos mysql 忘记密码,无密码登录,重新登录

    上一节的MySQL的配置安装里 并没有用到配置文件my ini 那在MYSQL8 0 13如何解决密码重置问题呢 我去网上搜了好多的资料都是改配置文件my ini的 后来终于找到了一条命令 操作步骤如下 1 打开命令窗口cmd 输入命令 n
  • Android开发学习【简单控件】

    Android开发学习 Day01 Android onCreate 详解 简单控件 文本显示 设置文本内容方式 设置文本的大小 设置文本的颜色 设置视图的宽高 直接设置 在代码中设置视图宽高 设置视图间距 设置视图的对齐方式 线性布局Li