I have an android app which presents list of items with icons.
icon1 - ItemName1
icon2 - ItemName2
icon3 - ItemName3
Like in latest gmail app when we long press on an item the icon displays tick mark indicating item is selected.
There could be one way that I have two icons (one normal and other with tick mark) and i can replace the icon on long press.
Is this correct approach or could there be a better option or some library for it from google ?
Regards
The solution was very simple. Found by navigating through stackoverflow.
For the icon put an imageview or imageviewbutton. Put a onClicklistener on it.
On click change the source of the imageview or imageviebutton to a image with selection indicator. You can also put an animation to make the image transition appear more smooth.
Regards, Ashwani Kr Sharma
Related
I want to make a small bubble over a button in android which essentially tell the number of times the button is clicked or added items to the cart. I believe its called badges in iOS environment, I don't know about android, but this is what I want to achieve:
I also found a working solution here: Add new item count to icon on button - Android
But this doesn't work on Android 5.0+. In 5.0+ versions the bubble is hidden behind the button completely.
In Working solution code if your arrange the button and the textview in Grid according to your need than it will solve your problem
Find more about Gridview Here
I have tried to duplicate the same custom RatingBar used in the Badoo App
http://s16.postimg.org/7l6dxqsr9/badoo_screens.png
Badoo App to download at:
play.google.com/store/apps/details?id=com.badoo.mobile&hl=en
The RatingBar has 10 stars with number into each one and fits perfectly no matter the size of the screen or in landscape mode
http://s16.postimg.org/4sd6dpset/device_2013_05_12_221153.png
Also, there is a animation on the current selected star (rating) as soon as you touch the Rating bar. The star grows up and turn back to the normal size when pressed. On the middle of the screen a dialog box appears too showing the current selection pressed (disappear a few seconds later after selected the rating).
I was wondering if someone would have similar RatingBar or if someone could help me how to develop that. I searched some samples but not like this particular case.
Thanks in advance.
We will open source some parts of it very soon and I will post here a link to the repository.
[EDIT] You can now browse the source, use it under MIT licence and see an example app here: https://github.com/badoo/StarBar
Thank you for your interest.
This might be a good starting point: http://kozyr.zydako.net/2010/05/23/pretty-ratingbar/
As for the animation, you may implement an OnRatingBarChangeListener to detect which star (or rating) was selected and animate the specific star.
I'm developing an application and I am facing a problem using ExpandableListView. What I'm trying to do is, in GroupHeader, not only show the group name, but also an spinner with options. That's because I want to show the football second division games in the list but, also, give the option to choose the round, in case the user wants to check older/future games. SO far I have that
As you can see both, title and spinner, shows. Also you can see the arrow on the right which is supposed to expand the list. Problem is that, if I click, only spinner opens, group expand button doesn't. So, here is my question, how can I make both of them work depending on where you click (one or another)??? Is that possible?
Also I must say that if I only place the TextView with the group name works perfect. If I only place the spinner, the problem persists. So I'm guessing that's a focus problem.
Btw: grey areas are the layout backgrounds, so no, they are not hiding behind the button.
I found the solution, I just neede to add this line android:descendantFocusability="blocksDescendants" to the Main Layout of the xml where I define the GroupHeader elements.
I am working on a game project.
I have 4 buttons on my screen. User has to select one of the 4. If user selects the correct one, it works fine. but if user selects incorrect one, I want to highlight the correct answer even though user didnt clicked it.
I have presentation due tomorrow. Can anybody point me to some example source or explain it here, as to how can I accomplish it.
You can set the correct buttons background color or image while clicking other buttons
Whenever user clicks on the incorrect button simply call :
correctButton.setPressed(true)
This will highlight the correct button as per your requirement.
you can do one thing..
Call Button.requestFocus() method to get the focus.
Create a custom selector for you Button's background. there
< item android:state_focused="true" android:drawable="#color/your_color" />
I have to create a small panel like thing with a border.
This should contain a text, an image that describes the text and a button.
On clicking that button I have to do some operations also.
Which widget is suitable for this?
Can anyone suggests any idea?
ImageButton is what I can think of. Try the ApiDemo sample application comes up with android sdk too. Another tool you might need is DroidDraw (Free android UI designer) and hierarchyviewer.bat(inside android sdk tools) can also help you if you want to know how the other developers use for such purpose.
I have assumed that you want to display button with images + Text,
You can do it with Button. There are 2 ways to do it(Button with Image and Text).
By xml, you can set
android:background attribute of
button and the text which you set,
will be appeared above the
background.
By code, You can use
setBackgroundDrawable() , it is
used to set the background of a
button.
and If you want to display panel(By clicking on the handle of that panel, it will comes up with the many items as home screen) , slidingDrawer widgets is the best solution.