Advertisement
Baru_Berbagi

MainActivity.java

May 23rd, 2021
1,957
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.93 KB | None | 0 0
  1. package com.baruberbagi.tabel;
  2.  
  3. import androidx.appcompat.app.AppCompatActivity;
  4.  
  5. import android.os.Bundle;
  6. import android.view.View;
  7. import android.widget.Button;
  8. import android.widget.TableLayout;
  9.  
  10. public class MainActivity extends AppCompatActivity {
  11.  
  12.     private boolean tabelku = false;
  13.  
  14.     @Override
  15.     protected void onCreate(Bundle savedInstanceState) {
  16.         super.onCreate(savedInstanceState);
  17.         setContentView(R.layout.activity_main);
  18.     }
  19.     public void ciutkanTabel(View view){
  20.  
  21.         TableLayout table = findViewById(R.id.tabel);
  22.         Button Button = findViewById(R.id.Button);
  23.  
  24.         table.setColumnCollapsed(1, tabelku);
  25.         table.setColumnCollapsed(2, tabelku);
  26.  
  27.         if (tabelku){
  28.             tabelku = false;
  29.             Button.setText("Tunjukkan detail");
  30.         }else {
  31.             tabelku = true;
  32.             Button.setText("Detail tersembunyi");
  33.         }
  34.     }
  35. }
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement