我想知道如何根據條件更改xml文件的佈局。因此,可以說,我們有一個佈局等..如何切換xml佈局排序
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/app_background"
android:padding="5dip"
>
<ListView android:id="@+id/xlist"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:cacheColorHint="#00000000"
android:divider="@drawable/listdivider"
android:dividerHeight="19dp"
/>
<TextView
android:layout_width="fill_parent"
android:background="@drawable/listdivider"
android:layout_height="19dp"
android:visibility="gone"
android:id="@+id/dividerline"
/>
<ListView android:id="@+id/ylist"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:cacheColorHint="#00000000"
android:divider="@drawable/listdivider"
android:dividerHeight="19dp"
/>
</LinearLayout>
</LinearLayout>
所以你設置兩個變量爲列表視圖,並基於「的Xlist」將「ylist」之前出現在XML 。但是對於我的代碼,如果滿足某個條件,我想切換此視圖的順序。那麼我將如何去切換訂單,以便如果滿足某個條件,「ylist」將出現在「xlist」之上?
我猜你的意思是編程,右? – m0skit0
修正得如此之多 Xadapter = xadapter; Yadapter = yadapter; xlist =(ListView)findViewById(R.id.xlist); ylist =(ListView)findViewById(R.id.ylist); – user1823974
好吧,你不需要XML標記,既不是OOP標記,因爲你的問題與OOP本身無關:) – m0skit0