I am developing an application to be used in an Android TV environment. I am having a problem about how to implement this using the D-Pad navigation.
I want to achieve this effect.
But I am having problems like:
how could I resize the ImageView at run-time?
how to have a hovered-state ImageView?
how to move the hovered button according to your d-pad input?
Currently this is my what I have done.
I implemented this using horizontal linear layout and ImageViews.
Thank you
Related
I have a case where have to dynamically change width of a button placed alongside another button in a horizontal linear layout. Button width change depend upon certain condition.
I have already tried many of solutions posted at stackoverflow, but the animation is never smooth. Lags on low-end devices. Some time the text within button seems to be sliding in which I don't want.
Here is what I want to achieve, pls see here how smoothly button width changes in google messages just want to achieve same animation.
Just for reference i've already top voted solutions here, for example Resizing layouts programmatically (as animation)
I am beginner in android animations and therefore, am wondering exactly how can I implement something like expand a cardView to show hidden options or elements.
For example: a post in social networking, we have a cardView holding the post info. it also has likes and comments buttons/options. When user taps on comments button the view should expand a little say certain height and show the comments and shrink back when the same button is tapped again.
I am listing my posts using RecyclerView in a Fragment using a CardView. I am looking for a soft animation along with expanding and shrinking back to original place or size.
Below is a screenshot that might help you understand what exactly I want:
How to do this? Will you please provide me a small snippet of code?
use wrap content as height of cardview and use textview inside it below title, so on click make the textview visible and invisible.
And use android:animateLayoutChanges="true" in parent layout.
There is compound widget which consists of VideoView and Button. VideoView play video, Button handle events. I'm struggling how to make it resizable according to pinch gesture.
Unfortunately, it is not possible to add pinch zoom to widgets, since there is no way to add event listeners to widgets. The only way a widget can receive input is assigning on click intents to different components, which start activities. As for videos, look into the VideoView class, although AFAIK this doesn't work well (if at all) with widgets.
I have a simple soundboard which uses Buttons to represent the sounds. When a sound button is clicked. The background image is changed using the view.
Button butt = (Button)view;
butt.setBackgroundResource(buttons_on[media]);
buttons_on is a int[] representing the drawables of the buttons.
This all works perfect, but I also use a FragmentActivity to create a paged App. The App has 4 different pages which you can swipe through. When I change a button using the above code and swipe two pages to the right and than swipe back. The image of the button has changed back to it's default defined in the page.xml.
How can I prevent this behavior?
change the Buttons to ImageButtons and setting the src?
somehow prevent the page from reloading
Instead of doing that you should look at how to use a StateListDrawable. It will simplify your approach.
I want to use menudrawer by SimonVt and it does exactly what I need. But the only problem is that I want to attach a ImageView to which I can drag to show/hide menu. I tried to set setSlideDrawable but it ain't working.
I can do it by setting onTouchListner and translate my ImageView while dragging. But, I'm pretty sure if I'm using this library there should be some way of doing it without this hassle.