界面本来是左侧绿色部分,点击一个按钮之后变成现在这个界面。
如果图片看不到请点击这里,http://zhidao.baidu.com/question/463581944.html?oldq=1  大家帮我看看这个是安卓什么特效,能提供类似代码的感激不尽~!!!!

解决方案 »

  1.   

    XML布局文件,layout目录下
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal" >    <LinearLayout
            android:id="@+id/layoutLeft"
            android:layout_width="fill_parent"
            android:layout_height="440dp"
            android:background="#CCCCCC"
            android:orientation="vertical" >
            <Button
                android:id="@+id/button1"
                style="?android:attr/buttonStyleSmall"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:onClick="changeLayoutShow"
                android:text="显示" />
            <Button
                android:id="@+id/button2"
                style="?android:attr/buttonStyleSmall"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="隐藏"
                android:onClick="changeLayoutHide" />    </LinearLayout>    <LinearLayout
            android:id="@+id/layoutRight"
            android:layout_width="match_parent"
            android:layout_height="420dp"
            android:background="#FFCCFF"
            android:visibility="invisible" >    </LinearLayout></LinearLayout>代码文件:package com.example.androidstudy;import android.app.Activity;
    import android.opengl.Visibility;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.LinearLayout;public class Activity2 extends Activity { @Override
    protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    this.setContentView(R.layout.activigy2);
    } @SuppressWarnings("deprecation")
    public void changeLayoutShow(View view){
    LinearLayout lleft = (LinearLayout)findViewById(R.id.layoutLeft);
    LinearLayout lRight = (LinearLayout)findViewById(R.id.layoutRight);

    lleft.setRight(getWindowManager().getDefaultDisplay().getWidth() - 100);
    lRight.setVisibility(View.VISIBLE);
    lRight.setLeft(getWindowManager().getDefaultDisplay().getWidth() - 100);
    lRight.setRight(getWindowManager().getDefaultDisplay().getWidth());
    }

    public void changeLayoutHide(View view){
    LinearLayout lleft = (LinearLayout)findViewById(R.id.layoutLeft);
    LinearLayout lRight = (LinearLayout)findViewById(R.id.layoutRight);

    lRight.setVisibility(View.INVISIBLE);
    lleft.setRight(getWindowManager().getDefaultDisplay().getWidth());
    }
    }