How to make a Button appear like a TextView in Android?

By | August 14, 2012

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>
Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

Leave a Reply

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