CopyPastor

Detecting plagiarism made easy.

Score: 0.8051779866218567; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2022-07-17
by Ajithkumar Muthukumaran

Original Post

Original - Posted on 2009-11-13
by emmby



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

Try this Create drawable name as ```button_bg.xml```
``` <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="false"> <layer-list> <!-- SHADOW --> <item> <shape> <solid android:color="#FFC107"/> <corners android:radius="20dp"/> </shape> </item>
<item android:bottom="10px" > <shape> <padding android:bottom="5dp"/> <gradient android:startColor="#FFEB3B" android:endColor="#FFEB3B" /> <corners android:radius="20dp"/> <padding android:left="10dp" android:top="10dp" android:right="5dp" android:bottom="10dp"/> </shape> </item> </layer-list> </item>
<item android:state_pressed="true"> <layer-list> <item> <shape> <solid android:color="#FFEB3B"/> <corners android:radius="20dp"/>
</shape> </item>
<item android:bottom="5px"> <shape> <padding android:bottom="5dp"/> <gradient android:startColor="#FFC107" android:endColor="#FFC107" /> <corners android:radius="20dp"/> <padding android:left="10dp" android:top="10dp" android:right="5dp" android:bottom="10dp"/> </shape> </item> </layer-list> </item> </selector> ``` in your xml layout set background for button/textview
``` <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent">
<TextView android:layout_width="180dp" android:layout_height="wrap_content" android:layout_centerInParent="true" android:background="@drawable/button_bg" // custom design android:textAlignment="center" android:textStyle="bold" android:text="Get Started" />
</RelativeLayout> ```
I discovered that this can all be done in one file fairly easily. Put something like the following code in a file named `custom_button.xml` and then set `background="@drawable/custom_button"` in your button view:
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" > <shape> <gradient android:startColor="@color/yellow1" android:endColor="@color/yellow2" android:angle="270" /> <stroke android:width="3dp" android:color="@color/grey05" /> <corners android:radius="3dp" /> <padding android:left="10dp" android:top="10dp" android:right="10dp" android:bottom="10dp" /> </shape> </item> <item android:state_focused="true" > <shape> <gradient android:endColor="@color/orange4" android:startColor="@color/orange5" android:angle="270" /> <stroke android:width="3dp" android:color="@color/grey05" /> <corners android:radius="3dp" /> <padding android:left="10dp" android:top="10dp" android:right="10dp" android:bottom="10dp" /> </shape> </item> <item> <shape> <gradient android:endColor="@color/blue2" android:startColor="@color/blue25" android:angle="270" /> <stroke android:width="3dp" android:color="@color/grey05" /> <corners android:radius="3dp" /> <padding android:left="10dp" android:top="10dp" android:right="10dp" android:bottom="10dp" /> </shape> </item> </selector>


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