0

ボタンがクリックされたときに、タグを切り離してgmt_option_list_dst_off.xml新しいレイアウトをタグに添付する必要があります。gmt_option_list_dst_on.xml<include>

xml ファイルは次のとおりです。

<?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>

実行時にタグを含めるために新しいレイアウトを添付することが可能であると私に提案してください。

私はいくつかの投稿を行ってきましたが、現在使用しています

parentOfAllInGMT.addView(layoutInflater.inflate(R.layout.gmt_option_list_dst_on, parentOfAllInGMT, true), 0);

しかし、これは正しくありません。

4

2 に答える 2

0

include タグを含む LineaerLayout で呼び出される addView() および removeViewAt を使用します。

于 2013-08-07T08:25:14.027 に答える