点击月份之后下面的那一栏变了,变成这样:
思路:动态删除并动态添加,
主要是要利用两个方法,我们先用控件(button)做实验,再过渡到布局,但是出现了空指针异常,说明并未获取到,所以需要动态加载布局
final LinearLayout monthLayout = (LinearLayout)findViewById(R.id.monthlinear); //14......
final LinearLayout bottomLayout = (LinearLayout)findViewById(R.id.bottom_);
final LinearLayout chooseLayout = (LinearLayout)findViewById(R.id.bottom_choosemonth);
final View mview = View.inflate(this,R.layout.choosemonth,null);
TextView tvmonth =(TextView)findViewById(R.id.text_view1_month);
final Button btn1 = new Button(this);
btn1.setText("1");
btn1.setText("Button1");
tvmonth.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
monthLayout.removeView(bottomLayout);
//monthLayout.addView(chooseLayout);
monthLayout.addView(mview);
}
});
LayoutInflater layout=this.getLayoutInflater();
View view=layout.inflate(R.layout.choosemonth, null);
ImageView ivfeb =(ImageView)view.findViewById(R.id.image_feb);
ivfeb.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
}
});