Как обновить XML-файл из другого XML-файла динамически?
Я хотел бы обновить XML-файл из другого XML-файла. Я использовал XML-файл, как показано ниже:
one.xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="#00BFFF">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:gravity="center" android:visibility="visible">
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:gravity="center" android:visibility="visible">
</LinearLayout>
</LinearLayout>
</ScrollView>
two.xml следующее:
<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<map>
<int name="linearLayout1" value="8" />
<int name="linearLayout2" value="0" />
</map>
Из приведенных выше двух файлов XML я хотел бы изменить значение атрибута один. XML, если если
<int name ="linearLayout1" value = "8"/>
изtwo.xml тогда я хотел бы обновитьone.xml файл как где LinearLayoutандроид: идентификатор = "@ + идентификатор / linearLayout1" затем измените значение атрибута какAndroid: видимость = "ушел".