解决方案 »

  1.   

    你可以试试看用要显示的那个控件的显示属性等于true,把它显示看能不能达到,在后台啊
      

  2.   

    代码还是比较简单的,
    button1.setOnClickListener(new OnClickListener(){
    gridView.setVisibility(View.GONE);
    });button2.setOnClickListener(new OnClickListener(){
    gridView.setVisibility(View.VISIBLE);
    });gridView隐藏前是有item显示的,隐藏后再显示然后item们就显示不出来了。下面是部分布局文件:
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="horizontal" >    <LinearLayout 
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="3"
            android:layout_margin="30dip"
            android:orientation="vertical">
            <GridView
             android:id="@+id/hall_gridView"
             android:layout_width="fill_parent"
             android:layout_height="fill_parent"
             android:drawSelectorOnTop="true"
             android:gravity="center"
             android:horizontalSpacing="0dip"
             android:listSelector="@drawable/lottery_item_bg"
             android:nextFocusLeft="@+id/main_tab_hall"
             android:nextFocusDown="@+id/main_tab_hall"
             android:nextFocusUp="@+id/top_exit"
             android:numColumns="1"
             android:scrollbars="none"
             android:stretchMode="columnWidth"
             android:verticalSpacing="30dip" />
        </LinearLayout>
        <LinearLayout
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:layout_weight="5">
              <ImageView
    />
        </LinearLayout>
    </LinearLayout>
      

  3.   

    现在解决掉了,谢谢各位。是由于布局的问题。因为以前我写的布局是一个线性布局里面包含两个线性布局,而每个线性布局都有各位的权重(layout_weight),必须要在父线性布局中加个属性:android:weightSum=8(我这里是8),否则gridView在隐藏后再显示,会被另外一个布局覆盖掉。具体原因不清楚。。