Friday, July 29, 2016

Custom Button With MagicButton


dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12' 
 compile 'com.android.support:appcompat-v7:24.0.0' 
 compile 'com.android.support:design:24.0.0' 
 compile 'com.github.bloder:magic:1.0'}
 
minSdkVersion 16
 
layout 
 
<?xml version="1.0" encoding="utf-8"?>
 <LinearLayout
 xmlns:android="http://schemas.android.com/apk/res/android" 
 xmlns:app="http://schemas.android.com/apk/res-auto" 
 xmlns:tools="http://schemas.android.com/tools" 
 android:layout_width="match_parent" 
 android:layout_height="match_parent" 
 android:orientation="vertical">

    <EditText 
 android:layout_width="match_parent" 
 android:layout_height="wrap_content" />

    <br.com.bloder.magic.view.MagicButton 
 android:id="@+id/magic_button_github" 
 android:layout_width="wrap_content" 
 android:layout_height="wrap_content" 
 android:layout_marginLeft="10dp" 
 android:layout_marginTop="10dp" 
 app:button_icon="@drawable/github" 
 app:button_icon_height="25dp
 app:button_icon_width="25dp" 
 app:expandable_area_color="#1c1e21" 
 app:hide_text="Github"         
app:icon_button_color="#464646" 
 app:magic_button_size="50dp" />

    <br.com.bloder.magic.view.MagicButton 
 android:id="@+id/magic_button_facebook" 
 android:layout_width="wrap_content" 
 android:layout_height="wrap_content" 
 android:layout_marginLeft="10dp" 
 android:layout_marginTop="30dp" 
 app:button_icon="@drawable/fb_white"
 app:button_icon_height="25dp" 
 app:button_icon_width="25dp" 
 app:expandable_area_color="#203763" 
 app:hide_text="Facebook" 
 app:icon_button_color="#365899" 
 app:magic_button_size="50dp" />

    <br.com.bloder.magic.view.MagicButton 
 android:id="@+id/magic_button_twitter" 
 android:layout_width="wrap_content" 
 android:layout_height="wrap_content" 
 android:layout_marginLeft="10dp" 
 android:layout_marginTop="30dp" 
 app:button_icon="@drawable/twitter" 
 app:button_icon_height="25dp" 
 app:button_icon_width="25dp" 
 app:expandable_area_color="#2f83de" 
 app:hide_text="Twitter" 
 app:icon_button_color="#ced0d4" 
 app:magic_button_size="50dp" />
</LinearLayout>
 

How about click event?

magicButton.setMagicButtonClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
        yourAction();
      }
});

 

  

No comments:

Post a Comment