android编程实现局部界面动态切换的方法

2019-12-10 19:55:06王冬梅

易采站长站为您分析android编程实现局部界面动态切换的方法,以实例形式较为详细的分析了Android局部切换的布局及功能实现技巧,具有一定参考借鉴价值,需要的朋友可以参考下

本文实例讲述了android编程实现局部界面动态切换的方法。,具体如下:

局部界面固定,局部界面可以动态切换。效果如下:

android编程实现局部界面动态切换的方法

android编程实现局部界面动态切换的方法

android编程实现局部界面动态切换的方法

这个效果由3个layout构成

main.xml

 

 
  1. <?xml version="1.0" encoding="utf-8"?>  <LinearLayout xmlns:android="http://www.easck.com/apk/res/android" 
  2. android:layout_width="fill_parent"  android:layout_height="fill_parent" 
  3. android:orientation="horizontal" >  <LinearLayout 
  4. android:layout_width="fill_parent"  android:layout_height="fill_parent" 
  5. android:layout_weight="1"  android:background="@android:color/black" > 
  6. <Button  android:id="@+id/btnSwitch" 
  7. android:layout_width="wrap_content"  android:layout_height="wrap_content" 
  8. android:text="switch" />  <Button 
  9. android:id="@+id/btnScreen"  android:layout_width="wrap_content" 
  10. android:layout_height="wrap_content"  android:text="screen" /> 
  11. </LinearLayout>  <LinearLayout 
  12. android:id="@+id/frameSwitch"  android:layout_width="160dp" 
  13. android:layout_height="fill_parent"  android:background="@android:color/white" > 
  14. </LinearLayout>  </LinearLayout>