当前位置: 首页 > news >正文

安卓学习记录

文章目录

  • Text_View
    • 基础属性
    • 字体阴影
    • 跑马灯
      • **activity_main.xml**
      • MyTextview
  • button

Text_View

ctrl+右键可以看到属性
代码整理采用的快捷键是ctrl+alt+L(电脑qq锁定快捷键,退一下qq就行了)

基础属性

在这里插入图片描述

字体阴影

在这里插入图片描述

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"><TextViewandroid:id="@+id/tv_one"android:layout_width="match_parent"android:layout_height="200dp"android:background="#A36F5E8E"android:gravity="center"android:shadowColor="@color/black"android:shadowRadius="6"android:shadowDx="5"android:shadowDy="5"android:text="@string/ccs"android:textColor="#6332BA"android:textSize="30sp"android:textStyle="bold"></TextView></LinearLayout>

在这里插入图片描述

跑马灯

在这里插入图片描述

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"><com.example.text1.MyTextviewandroid:id="@+id/tv_one"android:layout_width="match_parent"android:layout_height="200dp"android:background="#A36F5E8E"android:gravity="center"android:shadowColor="@color/black"android:shadowRadius="6"android:shadowDx="5"android:shadowDy="5"android:singleLine="true"android:ellipsize="marquee"android:marqueeRepeatLimit="marquee_forever"android:focusable="true"android:focusableInTouchMode="true"android:text="@string/ccs"android:textColor="#6332BA"android:textSize="30sp"android:textStyle="bold"></com.example.text1.MyTextview></LinearLayout>

MyTextview

方法一(麻烦):新建一个类
在这里插入图片描述

package com.example.text1;import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;import androidx.annotation.Nullable;public class MyTextview extends TextView {public MyTextview(Context context) {super(context);}public MyTextview(Context context, @Nullable AttributeSet attrs) {super(context, attrs);}public MyTextview(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {super(context, attrs, defStyleAttr);}@Overridepublic boolean isFocused() {return true;}
}

方法二:直接加一句代码:

<requestFocus/>

在这里插入图片描述

button

在这里插入图片描述

http://www.lryc.cn/news/228611.html

相关文章:

  • gradle 使用记录
  • 电源基础元件
  • [RK-Linux] updateEngine工具使用以及代码分析
  • MySQL | 数据库的表的增删改查【进阶】
  • 爱剪辑如何将视频旋转90度,详细操作流程
  • 三国杀中的概率学问题3——王荣
  • Linux - 实现一个简单的 shell
  • 不同优化器的应用
  • 学习网络编程No.9【应用层协议之HTTPS】
  • PSP - 蛋白质复合物结构预测 Template Pair 特征 Mask 可视化
  • RK3568开发笔记-amixer开机设置音量异常
  • STM32两轮平衡小车原理详解(开源)
  • 区间内的真素数问题(C#)
  • eclipse安装lombok插件
  • 故障演练 | 微服务架构下如何做好故障演练
  • Python爬虫-获取汽车之家车家号
  • No195.精选前端面试题,享受每天的挑战和学习
  • pytest与testNg自动化框架
  • 数据库安全:Hadoop 未授权访问-命令执行漏洞.
  • 前端---认识HTML
  • 竞赛 题目:基于FP-Growth的新闻挖掘算法系统的设计与实现
  • 保姆级jupyter lab配置清单
  • 数据结构预算法--链表(单链表,双向链表)
  • 数据结构线性表——栈
  • 自定义 springboot 启动器 starter 与自动装配原理
  • 16 _ 二分查找(下):如何快速定位IP对应的省份地址?
  • vb.net圣经带快捷键,用原装的数据库
  • Unity中Shader的雾效
  • 企业微信开发教程一:添加企微应用流程图解以及常见问题图文说明
  • 【LeetCode】67. 二进制求和