I need to detach the gmt_option_list_dst_off.xml
and attach a new layout gmt_option_list_dst_on.xml
in the <include>
tag, when button is clicked.
Following is the xml file:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:weightSum="6" >
<include
android:id="@+id/gmt_optionlist"
android:layout_weight="5"
layout="@layout/gmt_option_list_dst_off" />
<Button
android:id="@+id/dstbutton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="DST Off" >
</Button>
</LinearLayout>
Suggest me is this possible to attach a new layout to include tag at runtime.
I have gone through few post, and currently i am using
parentOfAllInGMT.addView(layoutInflater.inflate(R.layout.gmt_option_list_dst_on, parentOfAllInGMT, true), 0);
but this is not correct.