CopyPastor

Detecting plagiarism made easy.

Score: 1.9110683784874496; Reported for: String similarity, Exact paragraph match Open both answers

Possible Plagiarism

Plagiarized on 2015-01-19
by Deepak Kishore S

Original Post

Original - Posted on 2011-08-24
by Ljdawson



            
Present in both answers; Present only in the new answer; Present only in the old answer;

This can be achieved by creating a drawable xml file containing a list of states for the button. So for example if you create a new xml file called "button.xml" with the following code:
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/YOURIMAGE" /> <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/gradient" /> <item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/gradient" /> <item android:drawable="@drawable/YOURIMAGE" /> </selector>
To keep the background image with a darkened appearance on press, create a second xml file and call it gradient.xml with the following code:

<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <bitmap android:src="@drawable/YOURIMAGE"/> </item> <item> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <gradient android:angle="90" android:startColor="#880f0f10" android:centerColor="#880d0d0f" android:endColor="#885d5d5e"/> </shape> </item> </layer-list>
android:background="@drawable/button"
This can be achieved by creating a drawable xml file containing a list of states for the button. So for example if you create a new xml file called "button.xml" with the following code:
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/YOURIMAGE" /> <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/gradient" /> <item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/gradient" /> <item android:drawable="@drawable/YOURIMAGE" /> </selector>
To keep the background image with a darkened appearance on press, create a second xml file and call it gradient.xml with the following code:
<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <bitmap android:src="@drawable/YOURIMAGE"/> </item> <item> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <gradient android:angle="90" android:startColor="#880f0f10" android:centerColor="#880d0d0f" android:endColor="#885d5d5e"/> </shape> </item> </layer-list>


In the xml of your button set the background to be the button xml e.g.
android:background="@drawable/button"


Hope this helps!

Edit: Changed the above code to show an image (YOURIMAGE) in the button as opposed to a block colour.

        
Present in both answers; Present only in the new answer; Present only in the old answer;