Advertisement
Guest User

sed

a guest
Mar 19th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.42 KB | None | 0 0
  1.  
  2. package com.example.user.msn3;
  3.  
  4. import android.graphics.Color;
  5. import android.support.v7.app.AppCompatActivity;
  6. import android.os.Bundle;
  7. import android.view.View;
  8. import android.widget.Button;
  9. import android.widget.LinearLayout;
  10. import android.widget.RadioButton;
  11. import android.widget.RadioGroup;
  12.  
  13. public class MainActivity extends AppCompatActivity {
  14.  
  15.     Button CLR, CBG;
  16.     RadioButton Rgb, rGb, rgB;
  17.     RadioGroup RG;
  18.     LinearLayout LY;
  19.     @Override
  20.     protected void onCreate(Bundle savedInstanceState) {
  21.         super.onCreate(savedInstanceState);
  22.         setContentView(R.layout.activity_main);
  23.         RG = (RadioGroup) findViewById(R.id.RG);
  24.         CLR = (Button) findViewById(R.id.CLR);
  25.         CBG = (Button) findViewById(R.id.CBG);
  26.         Rgb = (RadioButton) findViewById(R.id.Rgb);
  27.         rGb = (RadioButton) findViewById(R.id.rGb);
  28.         rgB = (RadioButton) findViewById(R.id.rgB);
  29.         LY = (LinearLayout) findViewById(R.id.LY);
  30.     }
  31.  
  32.  
  33.     public void CLR(View view){
  34.         RG.clearCheck();
  35.         LY.setBackgroundResource(R.drawable.white);
  36.  
  37.     }
  38.  
  39.     public void CBG(View view){
  40.         if(Rgb.isChecked()){
  41.             LY.setBackgroundResource(R.drawable.red);
  42.         }
  43.         else if(rgB.isChecked()){
  44.             LY.setBackgroundColor(R.drawable.blue);
  45.         }
  46.         if(rGb.isChecked()){
  47.             LY.setBackgroundColor(R.drawable.green);
  48.         }
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement