thedazzler / droidicon Goto Github PK
View Code? Open in Web Editor NEWOver 1600 customizable icons for Android including 750+ Google Material Design icons, 25 ready-made social badges, and more!
Over 1600 customizable icons for Android including 750+ Google Material Design icons, 25 ready-made social badges, and more!
I used the instagram badge but there's just a blue circle and the instagram icon was too tiny. Hope you can fix this. Other badges works well. Thank you!
I have a button in my code like this. Note that I have the circular background be transparent:
<com.thedazzler.droidicon.badges.DroidiconBadge
android:id="@+id/nav_calibration_badge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
droidicon:db_bg_color="@android:color/transparent"
droidicon:db_icon_color="#f44336"
droidicon:db_icon="fa-compass"
droidicon:db_size="36dp"
droidicon:db_icon_padding="8dp"/>
I'm trying to find a way to change the background color in code, but I'm not how to do so. Using DroidiconBadge.setBackground(...) changes the background to a square.
how can i get icon text in java code?
Failed to resolve: com.github.theDazzler:droidicon:x.y.z
so how fix this?
Hi there,
I use droidicon for my app and it works great. Now I need the instagram icon and I have followed the same steps as usual, just like the facebook icon. The logo of instagram appears like 1 pixel in size compared to facebook, but the code is the same. See below and see attached screenshot.
Can anyone help me? Thanks.
<com.thedazzler.droidicon.badges.FacebookDroidiconBadge
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp"
app:db_size="40dp"
android:id="@+id/am_iv_facebook" />
<com.thedazzler.droidicon.badges.InstagramDroidiconBadge
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp"
app:db_size="40dp"
android:id="@+id/am_iv_instagram" />
So I did a test with a pre built icon and a custom icon. The premade icon show correctly but the custom icon just shows a green circle with an android in it. Even I specified the icon the in the xml like so? Please help?
<LinearLayout
xmlns:droidicon="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<com.thedazzler.droidicon.badges.AndroidDroidiconBadge
android:layout_width="wrap_content"
android:layout_height="wrap_content"
droidicon:db_bg_color="@color/black"
droidicon:db_icon_color="@color/white"
droidicon:db_icon="fa-user"
/>
<com.thedazzler.droidicon.badges.VimeoDroidiconBadge
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="4dp"
/>
</LinearLayout>
Hi,
I have a clean project created in Android Studio with DroidIcon added via Gradle. Using the example layout shown below the icon appears perfectly on a Nexus 5 running Lollipop, and a Nexus 5 on OS 21 .. but on a Galaxy S1 (yes, 1 :-p) running OS 18, no icon is shown, just the circular background .. the same happens on a Nexus 7. I don't think it's an OS issue, I get the feeling it's more to do with screen density or something because if I go to this method
private void updateTextSize(Rect viewBounds)
.. and edit out the second setTextSize, which is after the delta is applied, the icons appear on all devices .. far too big and cut off, but they do appear, so the missing icon might not be to do with the icon not displaying at all, just that it displays too small after the delta is applied?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:droidicon="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity$PlaceholderFragment">
<com.thedazzler.droidicon.badges.DroidiconBadge
android:layout_width="wrap_content"
android:layout_height="wrap_content"
droidicon:db_bg_color="@android:color/black"
droidicon:db_icon_color="@android:color/white"
droidicon:db_icon="fa-user"
/>
</RelativeLayout>
Any ideas on how to fix this? I'm happy to give it a go myself if you point me in the right direction!
Thanks,
Steven
IconicFontDrawable icon = new IconicFontDrawable(context);
icon.setIcon("fa-trash");
icon.setIconColor(context.getResources().getColor(R.color.white));
deleteImg.setImageDrawable(icon);
This will draw nothing on the ImageView... I noticed that your "how-to" was using "setBackground" instead but I cannot seem to use setImageDrawable, because setBackground seems to scale the image with the parent container.
Any tips?
Hi,
I am wondering how can i create a icon with circular background?
what am i trying to do:
IconicFontDrawable iconicFontDrawable = new IconicFontDrawable(this.getApplicationContext());
iconicFontDrawable.setIcon("fa-thumbs-up");
iconicFontDrawable.setIconColor(getResources().getColor(R.color.light_blue));
//setBackground will fulfill the whole view with icon
i saw issue #19 however setBackgroundColor is not present anymore.
Can somebody help me?
Thanks
So I have the xml like this (from your "how-to" section)
%lt;com.thedazzler.droidicon.badges.DroidiconBadge
android:layout_width="wrap_content"
android:layout_height="wrap_content"
droidicon:db_bg_color="@color/blue"
droidicon:db_icon_color="@color/white"
droidicon:db_icon="fa-user"
/>
But it doesn't draw the icon on my layout, whatelse do I need to do?
how can i set gravity to center in linear layout for this component?
How can I set the custom font size in code?
I want to replace the i cons i use in navigation view with droidicon where i use menu layout.
this is my current layout:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_gravity="end">
<group android:id="@+id/menu_group_1"
android:checkableBehavior="single">
<item
android:id="@+id/menu_latest_news"
android:checked="true"
android:icon="@drawable/ic_earth_grey600_24dp"
android:title="@string/menu.drawer.stories.latest" />
<item
android:id="@+id/drawar_menu_saved_stories"
android:icon="@drawable/ic_download_grey600_24dp"
android:title="@string/menu.drawer.stories.saved" />
<item
android:id="@+id/drawar_menu_sources"
android:icon="@drawable/analytics_gray"
android:title="@string/menu.drawer.stories.resources" />
<item
My question is how can i add droidicon to my layout. Also how can i add icons programaticaly?
I'm using Android Studio 1.2 RC. I've just added the lib (version 0.1.9) to build.gradle
and I get the following error:
Error:(23, 9) Attribute application@icon value=(@mipmap/ic_launcher) from AndroidManifest.xml:23:9
Error:(23, 9) Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application@icon value=(@mipmap/ic_launcher) from AndroidManifest.xml:23:9
is also present at com.github.theDazzler:droidicon:0.1.9:13:9 value=(@drawable/ic_launcher)
Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:20:5 to override
At the Manifest, on line 23, inside the application
tag, I have android:icon="@mipmap/ic_launcher"
.
The project was created with Android Studio 1.2, which uses mipmap for icons and other drawables - you have a folder res/drawables
and then folders res/mipmap-hdpi
, res/mipmap-xhdpi
etcetera.
I've added the tools:replace="android:icon"
inside the application
tag and the error disappears.
I'll be useful if the demo app is published to Google Play. Or at least an APK to download :)
It would be cool to generate drawable resource.
However I set the color to them, they are always in some grey color
When using a custom icon (tried several icon sets) on Android Lollipop, the icon itself is very small (and stays that way despite changing it's size via droidicon:db_size
.
The circle resizes appropriately however.
Tried the same code on a device running Android 4.4.4 on which it works as expected.
Code used:
<com.thedazzler.droidicon.badges.DroidiconBadge
android:layout_centerHorizontal="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
droidicon:db_bg_color="@color/blue_800"
droidicon:db_icon_color="@color/white"
droidicon:db_icon="gmd-person"
droidicon:db_size="130dp"
/>
Is it possible to add a setIcon(String) method to DroidconBadge?
Something like
public void setIcon(String icon){
iconicFontDrawable = new IconicFontDrawable(getContext());
iconicFontDrawable.setIcon(icon);
iconicFontDrawable.setIconColor(iconColor);
iconicFontDrawable.setIconPadding((int) icon_padding);
iconicFontDrawable.setContourColor(contourColor);
iconicFontDrawable.setContour(contourColor, contourWidth);
iconicFontDrawable.drawContour(drawContour);
iconicFontDrawable.setAlpha(alpha);
if (SDK_INT < JELLY_BEAN) {
view_icon.setBackgroundDrawable(iconicFontDrawable);
} else {
view_icon.setBackground(iconicFontDrawable);
}
}
This would be very useful in adapters where xml inflating is not available.
compile 'com.android.support:design:23.0.0'
after adding the above library, Gradle build failed with error,
/SOURCE_CODE_PATH/build/intermediates/exploded-aar/com.github.theDazzler/droidicon/0.1.3/res/values/values.xml
Error:(2) Attribute "rippleColor" has already been defined
Error:Execution failed for task ':core:processReleaseResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/shahabuddin/Library/Android/sdk/build-tools/23.0.0/aapt'' finished with non-zero exit value 1
Removing the support design library resolves the problem.
I have the following:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="@dimen/spacing_large"
android:background="@color/red"
>
<com.thedazzler.droidicon.badges.DroidiconBadge
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="@color/orange"
app:db_icon_color="@color/white"
app:db_icon="gmd-warning"
app:db_icon_padding="1dp"
android:foregroundGravity="center_vertical"
/>
<TextView
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Warning!."
android:textColor="@color/white"
/>
</LinearLayout>
When I add the db_icon_padding="1dp", the icon isn't displayed. If I remove it, the icon is shown as expected.
Hi, I recently stumbled upon a weird error saying NullPointerException on updateTextSize. Any suggestion or insight why this happen?
Fatal Exception: java.lang.NullPointerException: Attempt to get length of null array
at com.thedazzler.droidicon.IconicFontDrawable.updateTextSize(IconicFontDrawable.java:245)
at com.thedazzler.droidicon.IconicFontDrawable.draw(IconicFontDrawable.java:181)
at android.widget.TextView.onDraw(TextView.java:5040)
at android.view.View.draw(View.java:13560)
at android.view.View.getDisplayList(View.java:12511)
at android.view.View.getDisplayList(View.java:12555)
at android.view.View.draw(View.java:13284)
at android.view.ViewGroup.drawChild(ViewGroup.java:2990)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2860)
at android.view.View.getDisplayList(View.java:12509)
at android.view.View.getDisplayList(View.java:12555)
at android.view.View.draw(View.java:13284)
at android.view.ViewGroup.drawChild(ViewGroup.java:2990)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2860)
at android.view.View.getDisplayList(View.java:12509)
at android.view.View.getDisplayList(View.java:12555)
at android.view.View.draw(View.java:13284)
at android.view.ViewGroup.drawChild(ViewGroup.java:2990)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2860)
at android.view.View.getDisplayList(View.java:12509)
at android.view.View.getDisplayList(View.java:12555)
at android.view.View.draw(View.java:13284)
at android.view.ViewGroup.drawChild(ViewGroup.java:2990)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2860)
at android.view.View.draw(View.java:13563)
at android.widget.FrameLayout.draw(FrameLayout.java:467)
at android.view.View.getDisplayList(View.java:12511)
at android.view.View.getDisplayList(View.java:12555)
at android.view.View.draw(View.java:13284)
at android.view.ViewGroup.drawChild(ViewGroup.java:2990)
at android.widget.ListView.drawChild(ListView.java:3245)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2860)
at android.widget.AbsListView.dispatchDraw(AbsListView.java:2631)
at android.widget.ListView.dispatchDraw(ListView.java:3240)
at android.view.View.draw(View.java:13563)
at android.widget.AbsListView.draw(AbsListView.java:4219)
at android.view.View.getDisplayList(View.java:12511)
at android.view.View.getDisplayList(View.java:12555)
at android.view.View.draw(View.java:13284)
at android.view.ViewGroup.drawChild(ViewGroup.java:2990)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2867)
at android.view.View.draw(View.java:13563)
at android.view.View.getDisplayList(View.java:12511)
at android.view.View.getDisplayList(View.java:12555)
at android.view.View.draw(View.java:13284)
at android.view.ViewGroup.drawChild(ViewGroup.java:2990)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2860)
at android.view.View.getDisplayList(View.java:12509)
at android.view.View.getDisplayList(View.java:12555)
at android.view.View.draw(View.java:13284)
at android.view.ViewGroup.drawChild(ViewGroup.java:2990)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2860)
at android.view.View.getDisplayList(View.java:12509)
at android.view.View.getDisplayList(View.java:12555)
at android.view.View.draw(View.java:13284)
at android.view.ViewGroup.drawChild(ViewGroup.java:2990)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2860)
at android.view.View.getDisplayList(View.java:12509)
at android.view.View.getDisplayList(View.java:12555)
at android.view.View.draw(View.java:13284)
at android.view.ViewGroup.drawChild(ViewGroup.java:2990)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2860)
at android.view.View.getDisplayList(View.java:12509)
at android.view.View.getDisplayList(View.java:12555)
at android.view.View.draw(View.java:13284)
at android.view.ViewGroup.drawChild(ViewGroup.java:2990)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2860)
at android.view.View.getDisplayList(View.java:12509)
at android.view.View.getDisplayList(View.java:12555)
at android.view.View.draw(View.java:13284)
at android.view.ViewGroup.drawChild(ViewGroup.java:2990)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2860)
at android.view.View.draw(View.java:13563)
at android.widget.FrameLayout.draw(FrameLayout.java:467)
at android.view.View.getDisplayList(View.java:12511)
at android.view.View.getDisplayList(View.java:12555)
at android.view.View.draw(View.java:13284)
at android.view.ViewGroup.drawChild(ViewGroup.java:2990)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2860)
at android.view.View.getDisplayList(View.java:12509)
at android.view.View.getDisplayList(View.java:12555)
at android.view.View.draw(View.java:13284)
at android.view.ViewGroup.drawChild(ViewGroup.java:2990)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2860)
at android.view.View.getDisplayList(View.java:12509)
at android.view.View.getDisplayList(View.java:12555)
at android.view.View.draw(View.java:13284)
at android.view.ViewGroup.drawChild(ViewGroup.java:2990)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2860)
at android.view.View.getDisplayList(View.java:12509)
at android.view.View.getDisplayList(View.java:12555)
at android.view.View.draw(View.java:13284)
at android.view.ViewGroup.drawChild(ViewGroup.java:2990)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2860)
at android.view.View.draw(View.java:13563)
at android.widget.FrameLayout.draw(FrameLayout.java:467)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:2458)
at android.view.View.getDisplayList(View.java:12511)
at android.view.View.getDisplayList(View.java:12555)
at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:1144)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2273)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2145)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1956)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1113)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4481)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
at android.view.Choreographer.doCallbacks(Choreographer.java:555)
at android.view.Choreographer.doFrame(Choreographer.java:525)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4867)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
at dalvik.system.NativeStart.main(NativeStart.java)
Thanks :)
I realise this library is probably discontinued now, but if anyone has any tips on how to get the icons to center in the middle of the circles for Android 24+, I'd be very grateful. To recreate this, just create a new project that supports 24 and runs on a device with 24, the custom icon will appear in the bottom left.
Thanks
How do I use METEOCONS? What would the icon name be?
Thanks
Hi, awesome work :)
Wondering can this work with drawables ? like:
background="@drawable/fa-home"
And add customized attrs like 'inverted' to drawable ?
Just like the CSS counterparts.
Instead of having to import the source code and add the project as a gradle subproject, it would be easier if you put droidicon on jCenter so one could simply do
repositories {
jcenter()
}
dependencies {
compile 'com.thedazzler.droidicon:droidicon:1.0'
}
If you need any help, feel free to ask.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.