android:textColor="@color/black"显示错误

如果你在 Android 开发中遇到了 android:textColor="@color/black" 显示错误的问题,可能是因为你在颜色资源文件中没有定义名为 "black" 的颜色。

解决方法是在颜色资源文件(通常在 res/values/colors.xml)中添加名为 "black" 的颜色,例如:

<color name="black">#000000</color>

同时,确保颜色代码是正确的。如果仍然存在问题,可以检查其他资源文件,以确保名称正确无误。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Android 开发 (实验五) 实验题目:Android 组件布局试验 指导老师: 班 级:计算机科学与技术系班 姓 名: 一、实验目的 1、掌握 Android 组件布局的使用方法 2、学会组件布局的重要属性与应用 3、能够根据需求,通过布局构建各类实际的页面。 二、实验内容 组 件 布 局 有 : LinearLayout 、 TableLayout 、 FrameLayout 、 RelativeLayout 三、实验步骤 1、用表格布局完成登录界面 <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#FFFFCC" android:stretchColumns="0,3" > <ImageView android:layout_width="fill_parent" android:layout_height="5dp"/> <TableRow> <ImageView android:layout_width="wrap_content" android:layout_height="100dp" android:src="@drawable/img" android:gravity="center" android:layout_span="4"/> </TableRow> <TableRow > <TextView/> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="right" android:text="@string/username" android:textStyle="bold" android:textColor="#000000"/> <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="left" android:minWidth="200px" android:id="@+id/ETname"/> </TableRow> <TableRow > <TextView/> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="right" android:text="@string/password" android:textStyle="bold" android:textColor="#000000"/> <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="left" android:minWidth="200px" android:inputType="textPassword" android:id="@+id/ETpwd"/> </TableRow> <TableRow> <TextView /> <Button android:id="@+id/Btok" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="right" android:text="@string/button" android:textStyle="bold"/> <Button android:id="@+id/Btcancel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="left" android:text="@string/cancel" android:textStyle="bold"/> </TableRow> </TableLayout> 2、使用线性布局完成系统主界面 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/an
TextView <style name="textview_style">//定义样式名字 <item name="android:textColor">@color/white</item>//文字白色 <item name="android:background">@color/black</item>//背景黑色 <item name="android:layout_width">wrap_content</item>//宽度为文本宽度 <item name="android:layout_height">wrap_content</item> //高度为文本高度 </style> <color name="white">#ffffff</color> <color name="black">#000000</color> style="@style/textview_style"// <TextView android:id="@+id/signer"//id android:layout_marginLeft="20px" android:textSize="14sp" android:text="歌手" android:textStyle="bold" /> ImageView <ImageView//定义图片显示组件名称 android:id="@+id/itemicon"//组件id android:src="@drawable/itemicon"//drawable读取图片id android:layout_width="50dp"//宽度 android:layout_height="50dp" //高度 /> ListView activity_mp3list.xml <ListView android:id="@+id/list"//id android:layout_width="match_parent"//宽度为设备的宽度 android:layout_height="wrap_content"// /> Mp3ListActivity.java private String[] date= {"月亮之上","自由飞翔","荷塘月色"};//数据 private ListView listview = null;//listview变量 super.setContentView(R.layout.activity_mp3list);//读取布局文件 this.listview = (ListView) super.findViewById(R.id.list);//获取组件 this.listview.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1,this.date));//设置内容 SeekBar activity_mp3player.xml <SeekBar //拖动条组件 android:id="@+id/seekbar"//id android:layout_width="match_parent"//宽度 android:layout_height="wrap_content" //高度 /> <TextView //文本组件 android:id="@+id/text"//id android:scrollbars="vertical"//滚动形式:垂直滚动 android:layout_width="match_parent"//宽度 android:layout_height="wrap_content" //高度 />

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值