infotech-group / Android Drawable Dsl
Licence: apache-2.0
DSL for constructing the drawables in Kotlin instead of in XML
Stars: ✭ 171
Projects that are alternatives of or similar to Android Drawable Dsl
Nodrawable
一个旨在减少99%的drawable.xml文件的库,可直接在布局文件中对任意View声明drawable属性。
Stars: ✭ 551 (+222.22%)
Mutual labels: drawable
Editdrawabletext
EditDrawableText - An EditText which makes your Drawable Clickable
Stars: ✭ 288 (+68.42%)
Mutual labels: drawable
Gradientdrawabletuner
🕹️ See how the properties of Android's "shape" affect the Drawable's appearance, intuitively.
Stars: ✭ 343 (+100.58%)
Mutual labels: drawable
ApngDrawable
ApngDrawable for android, high efficiency, low memory
Stars: ✭ 32 (-81.29%)
Mutual labels: drawable
Drawabletextview
自定义控件 :drawable 跟随TextView居中 The drawable follows the text centered
Stars: ✭ 124 (-27.49%)
Mutual labels: drawable
Gaussianblur
An easy and fast library to apply gaussian blur filter on any images. 🎩
Stars: ✭ 473 (+176.61%)
Mutual labels: drawable
Android Gif Drawable
Views and Drawable for displaying animated GIFs on Android
Stars: ✭ 8,987 (+5155.56%)
Mutual labels: drawable
Spedittool
An efficient and scalable library for inputing and displaying gif or @mention on graph-text mixed TextView/EditText
Stars: ✭ 292 (+70.76%)
Mutual labels: drawable
Appcompat Extension Library
A library that builds on the AppCompat Design Library and provides additional common components such as AccountHeaderView, FloatingActionMenu, CircleImageView, Picker Dialogs, FlexibleToolbarLayout, Delightful Detail Drawables and TypefaceCompat.
Stars: ✭ 307 (+79.53%)
Mutual labels: drawable
Youtube Play Icon
Material style morphing play-pause drawable for Android
Stars: ✭ 57 (-66.67%)
Mutual labels: drawable
Backgroundlibrary
A framework for directly generating shape through Tags, no need to write shape.xml again(通过标签直接生成shape,无需再写shape.xml)
Stars: ✭ 3,179 (+1759.06%)
Mutual labels: drawable
Drawablecolorchange
Android Library to dynamically change color of drawable.
Stars: ✭ 101 (-40.94%)
Mutual labels: drawable
TakingImageOfAView
An example on how to take screenshot of a particular view
Stars: ✭ 15 (-91.23%)
Mutual labels: drawable
Slice
Android drawable that allows you custom round rect position.
Stars: ✭ 605 (+253.8%)
Mutual labels: drawable
Android Animated Icons
How to improve the user experience using animated icons with vector drawables on Android
Stars: ✭ 117 (-31.58%)
Mutual labels: drawable
Ariana
Provide Multiple Gradients in ImageViews and Texts. Integrate with ViewPager to change colors dynamically.
Stars: ✭ 74 (-56.73%)
Mutual labels: drawable
Android Drawable Kotlin DSL
DSL for constructing the drawables in Kotlin instead of in XML
Examples
Shape drawables
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#199fff" />
<stroke
android:width="2dp"
android:color="#444444" />
</shape>
replace it with
shapeDrawable {
shape = GradientDrawable.OVAL
solidColor = Color.parseColor("#199fff")
stroke {
width = dip(2)
color = Color.parseColor("#444444")
}
}
State selectors
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true">
<shape>
<solid android:color="@android:color/black" />
</shape>
</item>
<item android:state_pressed="true">
<shape>
<solid android:color="@android:color/holo_red_dark" />
</shape>
</item>
<item>
<shape>
<solid android:color="@android:color/white" />
</shape>
</item>
</selector>
replace it with
stateListDrawable {
checkedState {
shapeDrawable {
solidColor = Color.BLACK
}
}
pressedState {
shapeDrawable {
solidColor = Color.RED
}
}
defaultState {
shapeDrawable {
solidColor = Color.WHITE
}
}
}
Layer drawables
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<stroke
android:width="5dp"
android:color="#000000" />
</shape>
</item>
<item>
<shape android:shape="oval">
<stroke
android:width="2dp"
android:color="#ffffff" />
</shape>
</item>
</layer-list>
replace it with
layerDrawable(
shapeDrawable {
shape = GradientDrawable.OVAL
stroke {
width = ctx.dip(5)
color = Color.parseColor("#000000")
}
},
shapeDrawable {
shape = GradientDrawable.OVAL
stroke {
width = ctx.dip(2)
color = Color.parseColor("#ffffff")
}
}
)
Install
repositories {
maven { url 'https://jitpack.io' }
}
compile "com.github.infotech-group:android-drawable-dsl:0.3.0"
Contribute
We haven't covered 100% of the XML DSL, contributions are very welcome
Please write a test for every new tag you add, we (hopefully) made it easy to do
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].