Android中的调色板功能的实现

实现调色板的详细步骤

这是实现后的效果图片1、 大体步骤: 1) 第一步在activity_main.xml中声明三个进度条(seekBar)和三个表示颜色的Textview控件。大容器用的布局是Linelayout,然后将显示颜色字体的textview和seekbar嵌套Linelayout布局。 2) 第二步:在mainactivity.java中设置监听器(OnSeekBarChangeListener),实现它的三个未实现的方法,在方法里面获取当前进度条的数值,用设置背景颜色的方法显示颜色,再用一个封装的将数值转化成十六进制的方法将其显示在textview中。2、 详细步骤: 1. 在activitity_main.xml中的代码:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="com.test.colorchanged.MainActivity" >

  <com.test.colorchanged.titlelayout 
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      ></com.test.colorchanged.titlelayout>

    <LinearLayout 
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        >

    <TextView
        android:id="@+id/txt1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:text="红色" />

    <SeekBar
        android:id="@+id/seekbar1"
        android:layout_width="match_parent"
       
  • 0
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值