Button

Android Button Highlight

In android, we can highlight the button through custom images. Here is a example that will give you about how to set a image when the button is focused, pressed and focused pressed.

Android Dialog with Radio Buttons

Now we can see a easy example of how to use radio groups, actions, and radio buttons dialog in android mobiles.

Example for Android Dialog Radio Buttons :-

[sourcecode language="java"]
public class ExampleApp extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final CharSequence[] PhoneModels = {"iPhone", "Nokia", "Android"};
AlertDialog.Builder alt_bld = new AlertDialog.Builder(this);
alt_b

Android ToggleButton

Android Toggle Button is used to set the button as checked or unchecked. We can set this toggle button to Yes or No also. We can change the toggle button text when the stage changes. We can set text for both On stage (ex: - “YES”) & Off stage (ex: - “NO”).

Default Text of ON Stage is "ON" & OFF Stage is "OFF".

Android RadioButton Example

RadioButton is used to select any one option from the given group.

In Android by using RadioGroup only we can use RadioButton. We can add any number of RadioButtons to a single RadioGroup.

Android Button Size

We can set Android button size manuallly by using the button property 'android:layout_height' & 'android:layout_width'.

Android Button Background Color

Android Button Background Color Example -

We can set the button background color by using the button property 'android:background' .

Android Widgets Button Image

Android Button Background Image Example:-

We can set the Background image for a button by using the button property 'android:background'.

Android Button Click

Today let us see an example for the Android button onclick -

[sourcecode language="java"]
<Button android:text="@+id/Button01"
android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
[/sourcecode]

Onclick Action:- Edit your Java code like this

[sourcecode language="java"]
public class SamButton extends Activity {
Private Button butexample;
@Override
protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.main);
// Declaring Button
butexample =

Android- Button Transparent

Here we are going to see how to make a button transparent in Android...

[sourcecode language="css"]

<Button android:background="@android:color/transparent"
android:text="@+id/Button01"
android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffff" />
[/sourcecode]

By using android:background="@android:color/transparent" the button background will become transparent

Th

Android Text Color

In Android, we can set text color for textview, edittext, buttons, etc...

Example:-

Input

Output

Syndicate content