Android indeterminate ProgressBar is not animating - android

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.

Related

Change the quality of an ImageView

I'm trying to make a splash screen, I'm doing that with react native, but I'm using android studio to create the style.
First of all, I'm following this video that uses this library.
I have the following code of my splash screen:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:layout_height="match_parent"
android:background="#color/primary"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
>
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:src="#drawable/launch_screen"
android:scaleType="centerCrop" />
</LinearLayout>
</RelativeLayout>
It looks like this:
As you can see, the quality of the logo is low, and I would like to make it better.
My drawable folder is the following:
Thanks!
It seems that your launch_screen.png file has a small resolution.
Change that file with bigger resolution with better quality.

How to achieve glow effect on focused icon in 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.

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

Can't Identify which element is used....?

I've an android application, which set Location based reminders. After I added an alarm, it displays as following.
I can't understand which component is used to display the small map and text both. Also the small map has location which I've selected on the map. I'm developing similar application, and I want to use this type of display feature.
That looks like a Lite mode Google Map to me.
this video is the best explanation on the internet and covers the use case i think you are refering to.
https://youtu.be/N0N1Xkc_1pU
You can check out my answer to another similar question here: https://stackoverflow.com/a/39462819/3456841
Here's the google developers page on the topic
https://developers.google.com/maps/documentation/android-api/lite
Also here's a link to a demo activity that uses lite maps in a list
https://github.com/googlemaps/android-samples/blob/master/ApiDemos/app/src/main/java/com/example/mapdemo/LiteListDemoActivity.java
you probably want your list item layout file to look something like
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_toLeftOf="#+id/map">
<TextView
android:id="#+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/location"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/created_at"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:name="com.google.android.gms.maps.MapFragment"
android:id="#+id/map"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_alignParentRight="true"
map:cameraZoom="13"
map:mapType="normal"
map:liteMode="true"/>
</RelativeLayout>
Note the map:liteMode="true" in the map fragment declaration.

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