Android 基础开发那些xml文件

values/colors.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
  <color name="black">#FF000000</color>
  <color name="white">#FFFFFFFF</color>
  <color name="red">#FFFF0000</color>
  <color name="green">#FF00FF00</color>
  <color name="blue">#FF0000FF</color>
  <color name="gray5">#0D000000</color>
  <color name="gray10">#1A000000</color>
  <color name="gray15">#26000000</color>
  <color name="gray20">#33000000</color>
  <color name="gray25">#40000000</color>
  <color name="gray30">#4D000000</color>
  <color name="gray35">#59000000</color>
  <color name="gray40">#66000000</color>
  <color name="gray45">#73000000</color>
  <color name="gray50">#80000000</color>
</resources>

values/strings.xml

<resources>
  <string name="app_name">App</string>
  <string name="tv_hello">Hello World!</string>
  <string name="tv_one">IntelliJ IDEA Android App HTML5 CSS3 JavaScript</string>
  <string name="login">登录</string>
  <string name="et_username">用户名</string>
  <string name="et_password">密码</string>
  <string name="add">Add</string>
  <string name="remove">Remove</string>
</resources>

values/themes.xml

<resources xmlns:tools="http://schemas.android.com/tools">
  <!-- Base application theme. -->
  <style name="Theme.App" parent="Theme.MaterialComponents.DayNight.DarkActionBar.Bridge">
    <!-- Primary brand color. -->
    <item name="colorPrimary">@color/purple_500</item>
    <item name="colorPrimaryVariant">@color/purple_700</item>
    <item name="colorOnPrimary">@color/white</item>
    <!-- Secondary brand color. -->
    <item name="colorSecondary">@color/teal_200</item>
    <item name="colorSecondaryVariant">@color/teal_700</item>
    <item name="colorOnSecondary">@color/black</item>
    <!-- Status bar color. -->
    <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
    <!-- Customize your theme here. -->
  </style>
</resources>

drawable/btn_background.xml

自定义按钮背景

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:drawable="@drawable/round" android:state_checked="true" android:state_pressed="false"/>
  <item android:drawable="@drawable/round" android:state_checked="false" android:state_pressed="false"/>
  <item android:drawable="@drawable/round" android:state_checked="true" android:state_pressed="true"/>
  <item android:drawable="@drawable/round" android:state_checked="false" android:state_pressed="true"/>
</selector>

drawable/round.xml

自定义图片

<?xml version="1.0" encoding="utf-8"?>
<shape
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:shape="rectangle" >
  <!-- 填充颜色 -->
  <solid android:color="#00FF6A" />
  <!-- 边框宽度,颜色 -->
  <stroke
    android:width="1.5dp"
    android:height="1.5dp"
    android:color="#00FF6A" >
  </stroke>
  <!-- 矩形尺寸 -->
  <size
    android:width="10dp"
    android:height="10dp"
  />
  <!-- 矩形的圆角半径 -->
  <corners
    android:topLeftRadius="6dp"
    android:topRightRadius="6dp"
    android:bottomLeftRadius="6dp"
    android:bottomRightRadius="6dp"
  />
</shape>

  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

望天吼

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值