Hello all…..

This is a simple trick where we can make the Button appear like a TextView in Android.

This is done by setting the background of Button to null like this.

b.setBackgroundDrawable(null);

This is the xml that contains the button.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<Button  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hello"
    android:textColor="#FFF"
    android:id="@+id/but"
    />
</LinearLayout>
 

3 Comments

  1. Talha Qamar September 29, 2012 at 12:52 pm

    What are the permissions required for running it?Please reply soon thanks.

     
    • James September 29, 2012 at 6:29 pm

      You dont need any permissions for this.

       
    • James September 29, 2012 at 6:31 pm

      Hello Talha Qamar:- You dont need any permissions for this.

       

Leave a Reply

Your email address will not be published. Required fields are marked *

 

 

 

Theme by HermesThemes

Copyright © 2018 CoderzHeaven. All Rights Reserved

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.