• Stars
    star
    247
  • Rank 164,117 (Top 4 %)
  • Language
    Java
  • Created over 7 years ago
  • Updated about 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An android library that is able to set a vector drawable at text view pre-Lollipop.

CompoundIconTextView

An android library that is able to set a vector drawable at text view pre-Lollipop.

Platform Language License Download CompoundIconTextView

Preview

PREVIEW

Features

  • Set a vector drawable at text view pre-Lollipop

Usage

Gradle

You should set this line in your gradle file if you set colors to vector drawable pre-Lollipop.

android {
    defaultConfig {
        vectorDrawables.useSupportLibrary = true
    }
}

Code

CompoundIconTextView tv = (CompoundIconTextView) findViewById(R.id.compoundIconTextView);

// set icon drawable
tv.setVectorDrawableTop(R.drawable.ic_android_black_24dp);
tv.setVectorDrawableLeft(R.drawable.ic_android_black_24dp);

// set icon color
tv.setIconColorResource(R.color.colorPrimary);

// set icon size
tv.setIconSizeResource(R.dimen.icon_size, R.dimen.icon_size);
tv.setIconSize(32, 32);

// clear icon
tv.setVectorDrawableRight(CompoundIconTextView.UNDEFINED_RESOURCE);

Xml

<?xml version="1.0" encoding="UTF-8"?>
 <com.github.aakira.compoundicontextview.CompoundIconTextView
     android:id="@+id/compoundIconTextView"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:drawablePadding="4dp"
     android:gravity="center"
     android:text="Hello World!"
     android:textColor="#3F51B5"
     android:textSize="16sp"
     app:cit_drawableLeft="@drawable/ic_android_black_24dp"
     app:cit_iconColor="#000"
     app:cit_iconHeight="16dp"
     app:cit_iconWidth="16dp" />

Attributes

attribute name description
cit_drawableLeft Sets a drawable or vector drawable to left of TextView
cit_drawableTop Sets a drawable or vector drawable to top of TextView
cit_drawableBottom Sets a drawable or vector drawable to bottom of TextView
cit_drawableRight Sets a drawable or vector drawable to right of TextView
cit_drawableStart Sets a drawable or vector drawable to start of TextView (for RTL)
cit_drawableEnd Sets a drawable or vector drawable to end of TextView (for RTL)
cit_iconWidth Sets a width of icon
cit_iconHeight Sets a width of icon
cit_iconColor Sets a icon color

Setup

Gradle

Add the dependency in your build.gradle

buildscript {
	repositories {
		jcenter()
	}
}

dependencies {
	compile 'com.github.aakira:compound-icon-textview:1.2.1@aar'
}

Using libraries

Author

Akira Aratani

  • Twitter
  • Mail

License

Copyright (C) 2017 A.Akira

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.

More Repositories

1

Kotlin-Multiplatform-Libraries

Kotlin Multiplatform Libraries. Welcome PR if you find or create new Kotlin Multiplatform Library.
2,040
star
2

ExpandableLayout

[Deprecated] An android library that brings the expandable layout with various animation. You can include optional contents and use everywhere.
Java
1,656
star
3

Napier

Logging library for Kotlin Multiplatform
Kotlin
587
star
4

OkWear

Easily connection between Android wear and Handheld (Mobile device)
Java
124
star
5

ExoPlayerManager

An android library that wraps the ExoPlayer and the IMA Android SDK which plays a video advertisement. This is written in Kotlin.
Kotlin
78
star
6

dagger-hilt-example

This repository is an example of the dagger android hilt plugin using an android view model
Kotlin
59
star
7

mpp-example

This project is a minimum example of Kotlin Multiplatform Project.
Kotlin
32
star
8

DaggerInstantApps

Instant apps sample using dagger2 android support.
Kotlin
32
star
9

flutter-graphql-example

Dart
19
star
10

KotlinNativeSample

KotlinNativeSampleProject, Android, iOS
Swift
16
star
11

multithread-mpp

This is the best architecture of Kotlin Multiplatform Project I think! This project works on background thread using kotlinx.Coroutines.
Kotlin
16
star
12

KotlinMultiplatformAndoridParcelize

Use the Parcelize Annotation of the Kotlin Android Extensions in Kotin Multiplatform projects
Swift
15
star
13

Java2KotlinPractice

Java
13
star
14

flutter-parallax-walkthrough

Dart
5
star
15

git_info_plus

Get git information from within the Flutter application
Dart
4
star
16

MaterialColorPaletteTemplate

This is values of color for Android
4
star
17

gmail-to-calendar

JavaScript
3
star
18

flutter-hierarchical-transitions

This is an example of hierarchical transitions on the flutter app.
Dart
1
star
19

Vim-Commands

convenience commands
1
star
20

dotfiles

my vimrc etc...
Shell
1
star
21

aakira

1
star