I
I
Igor2014-07-17 17:23:21
MySQL
Igor, 2014-07-17 17:23:21

How to quickly make a click effect for an ImageView or Button with a picture?

There is some image or a programmatically created Drawable that is assigned to an ImageView or Button. It is necessary to make the effect of pressing, so that it is fast and as beautiful as possible.
How to do it?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
I
Ilya, 2016-04-06
@entermix

Does this option work?

SELECT `id`, `country_id`, `title` FROM `country_regions` WHERE `country_id` IN ('3', '1') LIMIT 1

F
Faim, 2016-04-06
@Faim

This error occurs if you get data in more than 1 column in a subquery. It's not clear from your example what's going on. What result is expected from these requests?

F
FanKiLL, 2014-07-18
@FanKiLL

And what effect are you interested in, namely animation, or changing the color, border, changing the font size?
Then it can be done with styles.
For example red button

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true" >
        <shape>
            <solid
                android:color="#ef4444" />
            <stroke
                android:width="1dp"
                android:color="#992f2f" />
            <corners
                android:radius="3dp" />
            <padding
                android:left="10dp"
                android:top="10dp"
                android:right="10dp"
                android:bottom="10dp" />
        </shape>
    </item>
    <item>
        <shape>
            <gradient
                android:startColor="#ef4444"
                android:endColor="#992f2f"
                android:angle="270" />
            <stroke
                android:width="1dp"
                android:color="#992f2f" />
            <corners
                android:radius="3dp" />
            <padding
                android:left="10dp"
                android:top="10dp"
                android:right="10dp"
                android:bottom="10dp" />
        </shape>
    </item>
</selector>

Pay attention to android:state_pressed="true"means when the button is pressed, for example, these are different states, you can read more about such states here - for example, this way you can completely change the design of the button Then you hook this style to the button in the layout
<Button
                    android:id="@+id/btnCansel"
                    style="@style/button"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:background="@drawable/custom_red_button"
                    android:onClick="onClickCanselButton"
                    android:text="@string/clear" />

Pay attention to the android:background="@drawable/custom_red_button"style with the description of different states attached to the button.

B
bimeg, 2014-07-17
@bimeg

StateListDrawable

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question