当前位置: 首页 > 软件库 > 手机/移动开发 > >

Android-SwitchIcon

授权协议 Apache-2.0 License
开发语言 Java
所属分类 手机/移动开发
软件类型 开源软件
地区 不详
投 递 者 田文景
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Android-SwitchIcon

Google launcher-style implementation of switch (enable/disable) icon

image

Compatibility

This library is compatible from API 15 (Android 4.0.3).

Download

Add it in your root build.gradle at the end of repositories:

allprojects {
    repositories {
        ...
        maven { url "https://jitpack.io" }
    }
}

Add the dependency

dependencies {
    implementation 'com.github.zagum:Android-SwitchIcon:1.4.0'
}

Usage

SwitchIconView extends from AppCompatImageView so you can set icon with app:srcCompat

Set any icon (vector or image) to SwitchIconView and enjoy switchable icon in your app :)

Use app:si_tint_color to set color to icon. Default color is black;

Use app:si_disabled_color to set color when icon disabled. Default color is equals with app:si_tint_color;

Use app:si_disabled_alpha to set alpha when icon disabled. Default alpha is .5;

Use app:si_no_dash if you don't want to draw dash, when icon disabled;

Use app:si_animation_duration if you want to change switching state animation duration;

Use app:si_enabled to set initial icon state;

Fully customized implementation:

<com.github.zagum.switchicon.SwitchIconView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="8dp"
        app:si_animation_duration="500"
        app:si_disabled_alpha=".3"
        app:si_disabled_color="#b7b7b7"
        app:si_tint_color="#ff3c00"
        app:si_enabled="false"
        app:si_no_dash="true"
        app:srcCompat="@drawable/ic_cloud"/>

Public methods and fields:

var isIconEnabled: Boolean

  fun setIconEnabled(enabled: Boolean, animate: Boolean = true)

  fun switchState(animate: Boolean = true)

See sample project for more information.

License

Copyright 2017 Evgenii Zagumennyi

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
  • <Switch android:id="@+id/togBtn_OCROpen" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:checked="true"

  • 我使用这个简单的代码在Android 4.1或更高版本中设置通知。 它工作得很好,但我的问题来自SmallIcon和LargeIcon。 我理解SmallIcon显示在状态栏,LargeIcon显示在下拉列表中。 NotificationCompat.Builder builder = new NotificationCompat.Builder(this); builder.setTicker(

  • 实现思路:继承AppCompatButton,重写onDraw(Canvas canvas) import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.uti

  • I am making an Geo Fencing App with notifications in Android Studio. But I have the problem that the notifications are not showing up.It says that it has no small icon but I did include that in my cod

  • 图片着色 在 xml 文件中配置 android:tint="" android:tintMode="" 进行组合搭配从而实现着色的效果 Material Design 在线调色板 drawable 分辨率 本节出处 Android drawable微技巧,你所不知道的drawable的那些细节–郭霖 获取 dpi 通过以下方法来获取手机的 dpi float xdpi = getResource

  • 方法1: Class<?> clazz = Class.forName("com.android.internal.R$id");                              Field field = clazz.getField("icon");               field.setAccessible(true);               id_icon = fi

 相关资料
  • JNI绑定 Android上的Java资源 WebView代码组织

  • Native.js for Android封装一条通过JS语法直接调用Native Java接口通道,通过plus.android可调用几乎所有的系统API。 方法: currentWebview: 获取当前Webview窗口对象的native层实例对象 newObject: 创建实例对象 getAttribute: 获取对象(类对象/实例对象)的属性值 setAttribute: 设置对象(类对

  • Android++ 是一个免费的 Visual Studio 扩展,用于支持在 Visual Studio 上开发和调试原生的 Android 应用,主要基于 NDK 的 C/C++ 应用。同时包括可订制的发布、资源管理以及集成了 Java 源码编译。

  • Android(安卓)是一种基于Linux内核的自由及开放源代码的操作系统,主要使用于移动设备,如智能手机和平板电脑,由美国谷歌公司和开放手机联盟领导及开发。Android操作系统最初由Andy Rubin开发,主要支持手机。2005年8月由谷歌收购注资。2007年11月,谷歌与84家硬件制造商、软件开发商及电信营运商组建开放手机联盟共同研发改良Android系统。随后谷歌以Apache许可证的授

  • Android(安卓)是一种基于Linux内核的自由及开放源代码的操作系统,主要使用于移动设备,如智能手机和平板电脑,由美国谷歌公司和开放手机联盟领导及开发。Android操作系统最初由Andy Rubin开发,主要支持手机。2005年8月由谷歌收购注资。2007年11月,谷歌与84家硬件制造商、软件开发商及电信营运商组建开放手机联盟共同研发改良Android系统。随后谷歌以Apache许可证的授

  • 简介 该库提供J2SE的Swing、AWT等类的安卓实现,引用该库便能在Android上运行J2SE应用程序。 该库实现大多数必需功能,但不是全部的J2SE。 成功示例HomeCenter服务器,该服务器基于J2SE,同时完全运行于Android之上。 使用指引 该库依赖于开源工程HomeCenter。 它不含Activity,需另建Android工程,并引用本库。 Activity和res需作为