I want to set an animated image in my application.i use an animation-list to show it frame by frame but it's not working!!
please help me!!
here is Java code
_imagView=(ImageView)findViewById(R.id.imageView1);
_imagView.setBackgroundResource(R.drawable.anim);
AnimationDrawable anim1 = (AnimationDrawable) _imagView.getBackground();
anim1.start();
and here is anim.xml
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="#drawable/animationchoking0" android:duration="500" />
<item android:drawable="#drawable/animationchoking1" android:duration="500" />
<item android:drawable="#drawable/animationchoking2" android:duration="500" />
<item android:drawable="#drawable/animationchoking3" android:duration="500" />
<item android:drawable="#drawable/animationchoking4" android:duration="500" />
<item android:drawable="#drawable/animationchoking5" android:duration="500" />
<item android:drawable="#drawable/animationchoking6" android:duration="500" />
<item android:drawable="#drawable/animationchoking7" android:duration="500" />
<item android:drawable="#drawable/animationchoking8" android:duration="500" />
</animation-list>
According to the Development guide,you should not call start method directly in onCreate() of your Activity(Drawable Animation at the bottom).Try this:
_imagView.post(new Runnable() {
#Override
public void run() {
// TODO Auto-generated method stub
anim1.start();
}
});
Related
'''
<item>
<rotate
android:fromDegrees="45"
android:pivotX="0%"
android:pivotY="100%"
android:toDegrees="0" >
<shape android:shape="rectangle" >
<solid android:color="#color/white" />
</shape>
</rotate>
</item>
<item android:left="20dp">
<shape android:shape="rectangle" >
<solid android:color="#color/white" />
<corners android:radius="10dp" />
</shape>
</item>
'''
I am able to achieve left bottom tilted , but I want curved shaped on the left bottom
This should work
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:right="2dp">
<rotate
android:fromDegrees="15"
android:pivotX="0%"
android:pivotY="100%"
android:toDegrees="0">
<shape android:shape="rectangle">
<corners
android:bottomLeftRadius="0dp"
android:radius="250dp" />
<solid android:color="#color/white" />
</shape>
</rotate>
</item>
<item android:left="5dp">
<shape android:shape="rectangle">
<solid android:color="#color/white" />
<corners android:radius="15dp" />
</shape>
</item>
</layer-list>
I am trying to make may app Navigation bar color to none but its not working
My App Theme code
<style name="AppTheme" parent="#style/Theme.MaterialComponents.Light.DarkActionBar">
<item name="android:windowBackground">#drawable/icon_splash</item>
<item name="android:cacheColorHint">#ff000000</item>
<item name="android:windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="android:forceDarkAllowed">false</item>
<item name="android:enforceStatusBarContrast">false</item>
<item name="android:enforceNavigationBarContrast">false</item>
</style>
And its my problem
Image1
Is it possible to remove image preview from UI fileuploder component, without using file component?
here is my code=>
<field name="file">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">string</item>
<item name="source" xsi:type="string">TestGroup</item>
<item name="label" xsi:type="string" translate="true">File</item>
<item name="visible" xsi:type="boolean">true</item>
<item name="formElement" xsi:type="string">fileUploader</item>
<item name="elementTmpl" xsi:type="string">ui/form/element/uploader/uploader</item>
<item name="previewTmpl" xsi:type="string">Vendor_Module/image-preview</item>
<item name="required" xsi:type="boolean">false</item>
<item name="sortOrder" xsi:type="number">40</item>
<item name="uploaderConfig" xsi:type="array">
<item name="url" xsi:type="url" path="controller/index/upload"/>
</item>
</argument>
</field>
tried by removing item name= elementTmpl and previewTmpl but not working
can anybody help me to disable the image preview for fileupload.
Thanks in Advance.
Remove the src of image every time you click:
$("#input1").click(function () {
$('#imagepreview1').attr('src','');
});
I'm using my custom rating bar. The top image with 5 stars is on Lollipop where my ratingbar works fine. However, below Lollipop (Kitat, JellyBean, ICS) versions the rating bar is goofed up (check second image with a single star)
What can be the problem? I tried all possible methods, changing theme, managing height width...nothing seems to work :(
This is the style
<style name="customRatingBar" parent="#android:style/Widget.RatingBar">
<item name="android:progressDrawable">#drawable/rating_custom_bar</item>
</style>
This is the rating bar xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="#+android:id/background"
android:drawable="#drawable/star_blank"/>
<item
android:id="#+android:id/secondaryProgress"
android:drawable="#drawable/star_blank"/>
<item
android:id="#+android:id/progress"
android:drawable="#drawable/star_filled"/>
</layer-list>
This is star blank
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="#drawable/rating_empty" android:state_pressed="true" android:state_window_focused="true"/>
<item android:drawable="#drawable/rating_empty" android:state_focused="true" android:state_window_focused="true"/>
<item android:drawable="#drawable/rating_empty" android:state_selected="true" android:state_window_focused="true"/>
<item android:drawable="#drawable/rating_empty"/>
</selector>
This is star filled
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="#drawable/rating_full" android:state_pressed="true" android:state_window_focused="true"/>
<item android:drawable="#drawable/rating_full" android:state_focused="true" android:state_window_focused="true"/>
<item android:drawable="#drawable/rating_full" android:state_selected="true" android:state_window_focused="true"/>
<item android:drawable="#drawable/rating_full"/>
</selector>
I have the same problem and spend a lot of time in it, tried setting all parameters at the ratingBar but none work, but there was something weird. I was working with a friend in a project and he compiles the exact same code as I and doesn't have this issue, so I change the IDE to his and all starts working.
I was using "Android Developer Tools", the eclipse you used to download at https://developer.android.com/training/index.html which is an eclipse with the ADT already embedded.
I change to Java EE and download ADT following this instructions http://developer.android.com/sdk/installing/installing-adt.html
I hope this helps you with your problem.
Has been a while but never hurts to answer. Here is my 3 step solution regardless of SDK version.
1- Add this as your RatingBar in your xml layout:
<RatingBar
android:id="#+id/new_ratingbar"
android:progressDrawable="#drawable/custom_drawable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:numStars="5"
android:stepSize="0.5"/>
If needed, you can give the RatingBar minHeight and maxHeight or add other attributes as required.
2- Here is the drawable you would refer the above progressDrawable to:
custom_drawable.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="#android:id/background"
android:drawable="#drawable/rating_bar_empty" /> <!--this is your .png file-->
<item
android:id="#android:id/secondaryProgress"
android:drawable="#drawable/rating_bar_fill" /> <!--this is your .png file-->
<item
android:id="#android:id/progress"
android:drawable="#drawable/rating_bar_fill" /> <!--this is your .png file-->
</layer-list>
3- The last thing is to provide the .png files in your various drawable folders.
Does Google allow for icon transitions such as these to be created by the developer? Or is it the developers responsibility to create such "delightful" transitions? I'd really like to implement these in my app.
Specifically icons like this
You can create an animated icon using AnimatedDrawable and bitmap-based frames. On L, you can use AnimatedStateListDrawable to create stateful animations (such as the check box animation).
Here is an AnimatedDrawable example (actually this is the implementation for the check box on L preview) using 15ms-long frames that can be started and stopped from code:
<animation-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:duration="15" android:drawable="#drawable/my_icon_frame_000" />
...additional frames...
</animation-list>
And here is an AnimatedStateListDrawable using AnimatedDrawable transitions to implement a check box animation that starts and stops automatically based on View state:
<animated-selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:state_checked="true">
<bitmap android:src="#drawable/btn_check_to_on_mtrl_015" android:tint="?attr/colorControlActivated" android:alpha="?attr/disabledAlpha" />
</item>
<item android:state_enabled="false">
<bitmap android:src="#drawable/btn_check_to_on_mtrl_000" android:tint="?attr/colorControlNormal" android:alpha="?attr/disabledAlpha" />
</item>
<item android:state_checked="true" android:id="#+id/on">
<bitmap android:src="#drawable/btn_check_to_on_mtrl_015" android:tint="?attr/colorControlActivated" />
</item>
<item android:id="#+id/off">
<bitmap android:src="#drawable/btn_check_to_on_mtrl_000" android:tint="?attr/colorControlNormal" />
</item>
<transition android:fromId="#+id/off" android:toId="#+id/on">
<animation-list>
<item android:duration="15">
<bitmap android:src="#drawable/btn_check_to_on_mtrl_000" android:tint="?attr/colorControlNormal" />
</item>
...additional frames...
</animation-list>
</transition>
<transition android:fromId="#+id/on" android:toId="#+id/off">
<animation-list>
<item android:duration="15">
<bitmap android:src="#drawable/btn_check_to_off_mtrl_000" android:tint="?attr/colorControlActivated" />
</item>
...additional frames...
</animation-list>
</transition>
</animated-selector>