Android -- 常见控件的小效果
1,EditText控件
① 修改光标颜色
自定义drawable 创建cursor.xml文件
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle"
>
<solid android:color="#9bd435"/>
<size android:width="2dp"/> </shape>
控件中添加使用
android:textCursorDrawable="@drawable/cursor"
效果如下:

②修改选中图标
创建我们是这种两边类似于水滴效果的,现在我们来自定义一下
在EditText中设置这两个属性
android:textSelectHandleLeft="@mipmap/ic_launcher"
android:textSelectHandleRight="@mipmap/ic_launcher"
效果如下:

但是发现小米手机好像不行,不知道怎么回事
③选中颜色与EditView默认的下划线
android:backgroundTint="#9bd435"
android:textColorHighlight="#9bd435"
效果如下:

使用我们的Material Design主题来解决,先看看我们的效果吧
直接设置内容的颜色就行了,及我们的colorAccent属性。
2,ScrollView控件
①修改滑动条的样式
android:scrollbarThumbVertical="@drawable/scrollbar" 自定义滚动条颜色、样式
android:scrollbars="vertical" 滚动条的滑动效果
android:scrollbarStyle="insideInset" 滚动条相对于View在的位置
②修改滑动到顶部或者底部的效果
android:overScrollMode="never"
Android -- 常见控件的小效果的更多相关文章
- Android设置常见控件点击效果
一. Imageview的点击效果——图片稍微变暗突出点击效果 public class ClickImageView extends AppCompatImageView { public Clic ...
- Android --> 常见控件
1.TextView 主要用于界面上显示一段文本信息 2.Button 用于和用户交互的一个按钮控件 //为Button点击事件注册一个监听器public class Click extends ...
- Android常见控件— — —ProgressDialog
package com.example.uiwidgettest2; import android.app.Activity;import android.app.AlertDialog;import ...
- Android常见控件— — —AlertDialog
package com.example.uiwidgettest2; import android.app.Activity;import android.app.AlertDialog;import ...
- Android常见控件— — —ProgressBar
ProgressBar用于在界面上显示一个进度条,表示我们的程序正在加载一些数据. <?xml version="1.0" encoding="utf-8" ...
- Android常见控件— — —EditText
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android=" ...
- Android常见控件— — —Button
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android=&qu ...
- Android常见控件— — —TextView
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android=&qu ...
- Android给控件添加默认点击效果
Android控件点击效果 Android中Button控件是有点击效果的,但是像TextView.ImageView.各种Layout是没有点击效果的,给TextView设置点击事件后,加个点击效果 ...
随机推荐
- Leetcode Anagrams
Given an array of strings, return all groups of strings that are anagrams. Note: All inputs will be ...
- mongoose连接collection后自动加s的问题
这两天折腾mongoose,发现数据成功写入集合了,但是在Terminal查询的时候却查不到 于是show collections后发现在原来的集合底下,又生成了一个加了s的集合,shenmegui ...
- macos开发pgsql数据库
mac安装Postgresql作为数据库 最简单的方式是安装Postgres.App. 这个应用里自带了最新版本的PostgreSQL而且不需要学习数据库服务器启动和关闭的命令.程序安好后(别忘了拖拽 ...
- CI框架3
1.CI不能像smarty那样直接{}访问, <?php echo $ci;?> application\config\ config.php 日志查看 $config['lo ...
- 7.echo(),print(),print_r()的区别
echo是PHP语句, print和print_r是函数,语句没有返回值,函数可以有返回值(即便没有用) print() 只能打印出简单类型变量的值(如int,string) print_r() ...
- linux nginx 启动脚本
linux nginx 启动脚本 [root@webtest76 ~]# vi /etc/init.d/nginx #!/bin/bash # nginx Startup script for the ...
- INotifyPropertyChanged, Interface
Data Object(class) impliment INotifyPropertyChanged; then the Object can update BindingSource. Impli ...
- address_add
<include file="Header:header-address_add" /> <include file="Header:header-pu ...
- python计算apache总内存
#!/usr/bin/env python import os from subprocess import Popen, PIPE def getPid(): p=Popen(['pidof','h ...
- How to reset password for unknow root
1. Click "e" when entering the grub 2. Add option " init=/bin/sh" to linux line. ...