main.xml
@@@@@@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/radioGroup">
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Red"
android:id="@+id/radioButton1Id"/>
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yellow"
android:id="@+id/radioButton2Id" />
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Magenta"
android:id="@+id/radioButton3Id" />
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cyan"
android:id="@+id/radioButton4Id" />
</RadioGroup>
</RelativeLayout>
MainActivity.java
@@@@@@@@@
import android.os.Bundle;
import android.view.View;
import android.app.*;
import android.widget.*;
import android.graphics.*;
public class MainActivity extends Activity {
RadioGroup b;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
b= (RadioGroup) findViewById(R.id.radioGroup);
b.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup radioGroup, int i) {
switch (i){
case R.id.radioButton1Id:
getWindow().getDecorView().setBackgroundColor(Color.parseColor("#FF0000"));
break;
case R.id.radioButton2Id:
getWindow().getDecorView().setBackgroundColor(Color.parseColor("#FFFF00"));
break;
case R.id.radioButton3Id:
getWindow().getDecorView().setBackgroundColor(Color.parseColor("#FF00FF"));
break;
case R.id.radioButton4Id:
getWindow().getDecorView().setBackgroundColor(Color.parseColor("#00FFFF"));
break;
}
}
});
}
}
...........
This is BMMA Lessons For Android
Subscribe to:
Post Comments (Atom)
UI Vs UX ဘာေတြ ကြာသလဲ?
Ui Vs Ux (About) Original .Creativo 27 Next Next Next Next Thank you for reading . Bhone Myint ...
-
Phone Call Talker .................................. Full Projects Code Sell 1000 Kyats Mpt (Or) Ooredoo (Or) Telenor ...
-
Simple AnalogClock Example main.xml @@@@@@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" ...
-
Simple Claendar main.xml @@@@@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layo...
No comments:
Post a Comment