How to achieve glow effect on focused icon in Android? - android

I want to show a similar glow like on this image
I know how to get dominant color using Palette. I was wondering how to show a glow effect like this.

I did a similar couple of days ago using a Third-party library. Follow initial steps by adding dependency and maven from here.
below is the xml code of the Glowing button.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:orientation="vertical"
android:gravity="center"
android:background="#color/black"
android:layout_height="match_parent"
tools:context=".MainActivity">
<com.smb.glowbutton.GlowButton
android:id="#+id/myGlowButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="8dp"
app:gb_drawablePadding="50dp"
app:gb_drawableTint="#color/black"
android:paddingTop="5dp"
android:paddingBottom="5dp"
app:gb_text="Prime Video"
app:gb_textColor="#color/white"
app:gb_textSize="16dp"
app:gb_backgroundColor="#305B7B"
app:gb_cornerRadius="15dp"
app:gb_disabledTextColor="#808080"
app:gb_glowAnimationDuration="500"
app:gb_glowColor="#305B7B"
app:gb_rippleAnimationDuration="1500"
app:gb_rippleColor="#305B7B"
app:gb_rippleEnabled="true" />
</LinearLayout>
Output
Hope it would help you.

Related

Simple UI - how to?

Using Android studio 3.1, and I have a strange problem, I can't edit my UI,
I enter the content_main.xml, using the design tab, blueprint, anything i drag to the blueprint is not appearing, I use the infer constraints, still not helping
this is my XML code:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/constraintLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context=".MainActivity"
tools:showIn="#layout/app_bar_main">
<EditText
android:id="#+id/editText5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPersonName"
android:text="Name"
tools:layout_editor_absoluteX="53dp"
tools:layout_editor_absoluteY="168dp" />
</android.support.constraint.ConstraintLayout>
I would't recommand using the UI designer, you don't get the feeling of what you are really doing with it. You should learn how to directly edit the XML file, this isn't really harder and at least you know what you are doing.
You must drag the widget to the component tree
ver imagen

Android indeterminate ProgressBar is not animating

The strange situation I have
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"/>
<ProgressBar
android:id="#+id/my_progressBar"
style="#style/Widget.AppCompat.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminate="true"/>
</LinearLayout>
And the result is
The ProgressBar is not animating. I'm doing something wrong?
For future searches. It was pretty easy and pretty hard to find the mistake.
Just make sure, that your animations are ENABLED in phone developer options.
When I run the App on emulator, the animation does not work. But if I switch to a real device, the bar spins.

Ripple Effect Duration in Android XML

I am Learning Material Design. I tried ripple effect on button using this gradle
dependencies {
compile 'com.github.traex.rippleeffect:library:1.3'
}
from this https://github.com/traex/RippleEffect link
there are many attribute which are not working
such as
app:rv_rippleDuration="1200"
app:rv_color="#d3d3d3"
I have event on button and ripple effect but when I click on button method is get called. What I want is first ripple effect should get complete then action should occur.
XML code
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
<com.andexert.library.RippleView
android:id="#+id/ripple1"
android:layout_width="match_parent"
android:layout_height="match_parent"
rv_centered="true"
app:rv_rippleDuration="1800"
app:rv_color="#000000">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="New Button"
android:id="#+id/fromDateButton" />
</com.andexert.library.RippleView>
</LinearLayout>
user cannot experience animation.
You need to add xmlns:app="http://schemas.android.com/apk/res-auto" as an xmlns in your RippleView before using the app resource.
Problem in the example on the page of description in GitHab.
Change
rv_centered="true"
to
app:rv_centered="true"
and all will be done.
All attribute of ReppleView must contain app:

Is there any way to set the navigation drawer as visible always

Is there any way to set the navigation drawer as visible always?.
So that the user knows that there is something on the right/left.
Like what you see in Hangouts app.
I know hangouts uses SlidePaneLayout, But anyone knows how to achieve this using Navigation Drawer?.
Got It!!.. Simplicity at its best. No libraries, No complicated codes. Use SimplePaneLayout.
Just set the android:layout_marginLeft to a suitable value. :) Awesome :)
<android.support.v4.widget.SlidingPaneLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/slidingpanelayout">
<LinearLayout android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#CCC"
android:orientation="horizontal"
android:id="#+id/fragment_firstpane"/>
<LinearLayout android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000"
android:orientation="horizontal"
android:layout_marginLeft="40dp"
android:id="#+id/fragment_secondpane"/>
</android.support.v4.widget.SlidingPaneLayout>

Issue with sherlock actionbar

Image as seen in ICS
Where as when run in Gingerbread
XML code for the fragment
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#drawable/background"
android:id="#+id/homelayout" >
<ImageView
android:id="#+id/homepageLogo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#drawable/background"
android:alpha="255"
android:scaleType="fitXY" />
</LinearLayout>
Any reason for such strange behavior?
try changing
android:layout_width="match_parent"
android:layout_height="match_parent"
to
android:layout_width="wrap_content"
android:layout_height="wrap_content"
in your ImageView. I don't know how you use your XML, but by the looks of it you might also want to change te same parameters in the LinearLayout to "wrap_content". Now you are telling the ImageView to (probably) fill the whole area.
// Alex
The problem is observed only when you dynamically request for the actionbar from the code.
getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
If you do it using styles, this problem is not seen.

Categories

Resources