Skip to content

Instantly share code, notes, and snippets.

Added in Android Jelly Bean (4.1) - API 16 :
Regular (default):
<item name="android:fontFamily">sans-serif</item>
<item name="android:textStyle">normal</item>
Italic:
<item name="android:fontFamily">sans-serif</item>
<item name="android:textStyle">italic</item>
//build.gradle do root do projeto
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'io.fabric.tools:gradle:1.+'
}
<TextView
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:drawableLeft=”@drawable/ic_g_selector”
android:drawablePadding=“8dp” />
<selector xmlns:android=”http://schemas.android.com/apk/res/android">
<item android:drawable=”@drawable/ic_g_translate” />
</selector>
toolbar.setNavigationIcon(R.drawable.ic_close);
<ImageView
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
app:srcCompat=“@drawable/ic_close” />
// Gradle Plugin 2.0+
android {
defaultConfig {
vectorDrawables.useSupportLibrary = true
}
}
// Gradle Plugin 1.5
android {
defaultConfig {
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#000000"
android:pathData="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rsicarelli
rsicarelli / Triangle.java
Last active December 29, 2021 18:26
An programmatically example on how to create a Triangle view in Android.
public class Triangle extends View {
private Path path;
private Paint shapePaint;
private int fillColor;
private int type;
public Triangle(Context context, AttributeSet attrs) {
super(context, attrs);
init(context, attrs);