I am creating a form in which i have to put five different smiley icon in rating bar to get feedback from user.
I tried but at a time only one type of icon is being displaying.
I am trying by changing style in style.xml
<style name="customRatingBar" parent="#android:style/Widget.RatingBar">
<item name="android:progressDrawable">#drawable/ratingstars</item>
<item name="android:minHeight">32dip</item>
<item name="android:maxHeight">32dip</item>
</style>
Please suggest me how could we achieve this in android?
Thanks in advance.
Here is a ratingbar which uses face morphing animation to animate different smiley reactions.
SmileyRating github
You can clearly see that the smiley is changing its reaction slowly.
From my experience with RatingBar I would say ditch it completely and implement your own mechanism for getting the feedback. Maybe a horizontal linear layout with 5 circular buttons?
I had the same problem and the only way I found is to make a LinearLayout with the 5 different faces as elements, and manually control touch position to change faces from selected to unselected, emulating how an old plain android RatingBar works.
I recently made a library out if this implementation, maybe it can help you.
An example of the library working with faces:
Checkout this EmojiRatingBar library.
Related
I have been trying to customize a spinner, i try customize a style and/or write one layout. But in the end of the day i just change the background. the closest I got to what I want was:
<style name="Spinner" parent="Widget.AppCompat.Spinner">
<item name="backgroundTint">#A9292A</item>
</style>
and i only can change the side arrow by set the background.
what i trying to do is kinda like this :
EDIT:
I can do this by made my own layout but, this arrow going to be in all lines of the list and static. the arrow don't change for the down
By auther the style it's just change the backgaund an as i trying to put this arrow for the left side the text wil be above it.And also don't change the direction
Don't need give me the answer in strict way. But i hope a road to get.Can anyone help me? Thanks!
Not just DatePicker and TimePicker, but a lot of dialogs I use from third party libraries look like this ever since I switched to material design:
Even when using android themes like HoloDark. I've tried changing buttonBarPositiveButtonStyle in the style and a few more related attributes, but none work. I assume the issue is they're using material buttons now which use different styling. But has anyone figured out a way to fix this? Thanks
EDIT: Just to clarify the issue is the button background being right next to eachother and not being transparent. Either adding a slight margin or making the buttons transparent will do for me
you can use your customButton and applay custombutton style
Turns out adding
<item name="android:buttonBarPositiveButtonStyle">#style/Widget.MaterialComponents.Button.TextButton.Dialog</item>
to my theme fixed the issue
I want to have 2 different colored buttons for my app. I am currently using this in styles.xml but it applies this theme for the whole app:
<item name="android:colorButtonNormal">#color/primaryColor</item>
I tried using this in the button but it makes no difference,
android:backgroundTint="#color/accentColor"
Please help! I would appreciate clear answers as I cannot find the answer anywhere. Thanks!!
I have this design to achieve:
but the result I got is this:
As you can see I am asked to create the submit button much larger that it actually is, I've tried setting it as an image with no luck, also I've tried entering it as normal text and manipulate the theme but that didn't work either, I'm using the latest and greatest API 21 .. Lollipop.
here's the code to the item in my menu:
<item
android1:title="submit"
android1:id="#+id/userLoginSubmitActionBar"
app:showAsAction="always|withText"/>
Have you tried using android:actionLayout attribute of the <item> tag? It will let you set a custom layout to be displayed. You could use a TextView and set the text size appropriately :)
As for the arrows, if I am not wrong, < means up navigation while <- means presence of a navigation drawer, right?
This is really a hack I suppose but what the hell, here's my solution to my own contribution,
I've set
<item name="android:actionMenuTextAppearance">
to my own custom theme parenting from
<style name="myStyle" parent="android:style/TextAppearance.Holo.Widget.ActionBar.Title">
and the damn thing worked like magic ! haha... thank u guys, really, no need for the drum rolls in the background :D
I am writing an Android application at the moment, no knowledge of java what so ever, except what I have learnt in the last 5 hours. I've managed to implement a two screens and a nice looking layout.
I have three questions:
How do I set the Action Bar on Honeycomb to be transparent like in the Google Maps application? I want to be able to partially see the background graphic through it.
What code to use to empty five edit texts and a textview on button click? I've read something about a viewgroup, but I have no idea how to implement that...
I have a linearlayout with a tablelayout centred horizontally and vertically inside it, and eleven table rows in that. How do I set a partially transparent black as a sort of fill colour for the tablelayout without ruining the background of the linearlayout? Every time I try to set a fill colour it blacks out the entire background image of the layout surrounding it as well.
Plain english would be preferable because I am so new to this.
Thanks heaps for any replys, have a great day.
For the first question, I think you can do like below:
In the onCreate() method, before the setConentView() add:
getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
The Android system will automatically set background fill the whole screen.
create a transparent sharp "mysharp.xml"like below:
<?xml version="1.0" encoding="utf-8"?>
<shape>
<solid android:color="#55000000" />
</shape>
set the action background
getActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.mysharp));
you can also declare action bar overlay in xml by
<item name="android:windowActionBarOverlay">true</item>
just like here http://developer.android.com/resources/samples/HoneycombGallery/res/values/styles.html
Answer to your 1st question: You can implement a theme on the HoneyComb action bar. Check this link for more info. The color would be something like this: #29000000.
The first hex 2-digit(#29) represents alpha channels of color and set opacity. If value is “00” that means 100% transparent. if value is set it will be opaque, it can be any value in 00 to FF.
More links on styling the Action Bar:
http://android-developers.blogspot.com/2011/04/customizing-action-bar.html
Example project is to be found here:
http://p-xr.com/customizing-the-action-bar-in-honeycomb/
In my Android 3 application I used
// Makes Action Bar Transparent
requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
actionBar = getActionBar();
actionBar.setBackgroundDrawable(null);
// END
and now the action bar is 100% transparent, Except for the stuff I add to it of course :)
Cheers