织梦CMS - 轻松建站从此开始!

360BC游戏

当前位置: 主页 > 手机游戏

Android中设置控件的背景颜色的方式整理

时间:2025-09-28 18:54来源:本站 作者:admin666 点击:
? xml version="1.0" encoding="utf-8" ? RelativeLayout xmlns:android ="http://schemas.android.com/apk/res/android" xmlns:tools ="http://schemas.android.com/tools" android:id ="@+id/activity_main" android:layout_width ="match_parent" android:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:id="@+id/tv_colorint"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="10dp"
        android:text="使用-12590395的颜色值"
        android:layout_centerInParent="true"/>

    <TextView
        android:id="@+id/tv_colorhex"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="10dp"
        android:text="使用#3FE2C5的颜色值"
        android:layout_below="@id/tv_colorint"
        android:layout_centerHorizontal="true"
        android:layout_margin="10dp"/>

    <ImageView
        android:id="@+id/img_color"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:src="#ffffff"
        android:background="@mipmap/ic_launcher"
        android:contentDescription="@string/app_name"
        android:layout_below="@id/tv_colorhex"
        android:layout_centerHorizontal="true"
        android:layout_margin="10dp"
        />
</RelativeLayout>
(责任编辑:蚂蚁团队)
织梦二维码生成器
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:点击我更换图片
栏目列表
推荐内容