画面の左側と中央に 1 つずつ、合計 2 つのテーブルを作成しました。アプリケーションを起動すると、左側のテーブルが表示に設定され、中央のテーブルが非表示に設定されます。
ここで、左側のテーブル (Buton_left) のボタンをクリックすると、中央のテーブル全体が表示されます。
これまでのところ、この方法がありますが、機能していないようです。どんな助けや提案もいただければ幸いです。さらに情報が必要な場合はお知らせください。
package com.example.musicapp;
import android.os.Bundle;
public class Tbl_Show_Hide extends Activity implements OnClickListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TableLayout table_left = (TableLayout)findViewById(R.id.table_left);
TableLayout table_center = (TableLayout)findViewById(R.id.table_center);
Button Buton_left = (Button)findViewById(R.id.Buton_left);
table_left.setOnClickListener(this);
table_center.setOnClickListener(this);
Buton_left.setOnClickListener(this);
}
@Override
public void onClick(View v) {
boolean visible = true;
int targetId = v.getId();
if(targetId == R.id.Buton_left)
{
if(visible)
{
if(table_center.getVisibility() == View.INVISIBLE)
{
table_center.setVisibility(View.VISIBLE);
}
}
}
}