Saturday 23 September 2017

Play Song

step 1;

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    
android:orientation="vertical" 
android:layout_width="match_parent"    
android:layout_height="match_parent"    
android:gravity="center">
<Button    
android:id="@+id/play"    
android:layout_width="100dp"    
android:layout_height="100dp"    
android:background="@drawable/image"/>
</LinearLayout>
step 2:

MainActivity.java
public class MainActivity extends AppCompatActivity {

    MediaPlayer mPlayer;

    @Override    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Button button = (Button)findViewById(R.id.play);
     button.setOnClickListener(new View.OnClickListener() {
         @Override         
public void onClick(View v) {
             if (mPlayer != null) {
                 mPlayer.stop();
                 mPlayer.reset();
             }

             mPlayer = MediaPlayer.create(MainActivity.this, R.raw.song);
             mPlayer.start();
         }

     });

    }}

step 3:

res/raw/song.mp3>>>>>>> user song

step 4:

res/drawable/image.pnd>>>>>> user image

Saturday 16 September 2017

Shape

shape 1:
<?xml version="1.0" encoding="utf-8"?>
<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">

   <solid 
       android:color="#666666"/>

   <size 
       android:width="120dp"
        android:height="120dp"/>
</shape>
shape 2:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">
    <stroke
        android:width="1dp"
        android:color="#78d9ff"/>
</shape>
shape 3:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">
    <solid
        android:color="#48b3ff"/>
</shape>
shape 4:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">
    <solid android:color="#199fff"/>
    <stroke
        android:width="2dp"
        android:color="#444444"/>
</shape>
shape 5:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval">
        <solid android:color="#9F2200"/>
        <stroke android:width="2dp" android:color="#fff" />
        <size android:width="80dp" android:height="80dp"/>
</shape>
shape 6:
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="200dp"
    android:height="200dp"
    android:viewportHeight="64"
    android:viewportWidth="64">

    <path
        android:fillColor="#ff00ff"
        android:pathData="M22,32
        A10,10 0 1,1 42,32
        A10,10 0 1,1 22,32 Z" />
</vector>
shape 7:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true">
        <shape android:shape="oval">
            <solid android:color="@color/color_accent_dark" />
        </shape>
    </item>
    <item>
        <shape android:shape="oval">
            <solid android:color="@color/color_accent" />
        </shape>
    </item>
</selector>
shape 8:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">
    <!--circle filling color-->
    <solid android:color="#ffffff" />
    <stroke
        <!--radious can define in here-->
        android:width="1dp"
        android:color="#ffffff" />
    <corners
        android:bottomLeftRadius="2dp"
        android:bottomRightRadius="2dp"
        android:topLeftRadius="2dp"
        android:topRightRadius="2dp" />
</shape>
shape 9:
<?xml version="1.0" encoding="utf-8"?>
<gradient android:startColor="@color/red" android:endColor="@color/red"
          android:angle="270"/>
<size android:width="250dp" android:height="250dp"/>
shape 10:
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="#87c27e"    />
    <corners android:bottomRightRadius="15dip" android:bottomLeftRadius="15dip"        android:topLeftRadius="15dip" android:topRightRadius="15dip"        />
</shape>

HOW TO CREATE CIRCLE IMAGE VIEW

Step 1: implementation 'de.hdodenhof:circleimageview:3.0.0' Step 2: <de.hdodenhof.circleimageview.CircleImageView xmlns:ap...