0

我创建了一个列表视图应用程序然后我决定为列表视图设计页眉和页脚我的问题是我的页眉和页脚在后台显示我的列表视图。我希望隐藏此页眉和页脚列表视图项目,所以请帮助我如何隐藏?

代码:

public class Settings extends Activity { 
    private SettingsAdapter setAdap;
    private SettingsInnerAdapter setInnerAdap;
    private ListView lstView;
    int top;
    private int mSelPosition = 0;
    private boolean innerListView = false;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
        WindowManager.LayoutParams.FLAG_FULLSCREEN); 

        setContentView(R.layout.testing);
        int width = getWindowManager().getDefaultDisplay().getWidth();
        int height = getWindowManager().getDefaultDisplay().getHeight();

        ImageView imgHead = (ImageView)findViewById(R.id.imageView1);

        ImageView imgbottom = (ImageView)findViewById(R.id.imageView2);


        imgbottom.setImageResource(R.drawable.back);
        imgbottom.setLayoutParams(new RelativeLayout.LayoutParams(width/8, height/8));


        imgHead.setImageResource(R.drawable.b);
        imgHead.setLayoutParams(new RelativeLayout.LayoutParams(width/8, height/8));

        setAdap = new SettingsAdapter(this.getApplicationContext());
        setAdap.updateImageSize(width, height);
        setAdap.setTextVisible(0);
       setAdap.setInnerViewVisible(false);


        lstView = (ListView)findViewById(R.id.lstLeft);
    lstView.setScreenDimension(width/16, height / 4 , width, height / 2);
        lstView.setAdapter(setAdap);
        lstView.setSelected(false);

      }

xml代码:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:layout_alignParentLeft="true"
    android:orientation="vertical" 
    android:background="@drawable/blue">

    <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="60px"
        android:orientation="horizontal"
        android:layout_alignParentTop="true"
        android:background="@drawable/gradient_black"
        android:id="@+id/ttest"

        >


        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"

        />

        <TextView
            android:id="@+id/header_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:layout_marginLeft="6dp"
            android:layout_toRightOf="@+id/imageView1"
            android:text="settings"
            android:textColor="@color/white"
            android:textSize="20sp" />

    </RelativeLayout>

    <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="55px"

        android:background="@drawable/gradient_black"
        android:gravity="bottom"
        android:orientation="horizontal"
        android:layout_alignParentBottom="true" >
  <ImageView
            android:id="@+id/imageView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="ssss"
        />  



    </RelativeLayout>
  <ListView
            android:id="@+id/lstLeft"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_below="@+id/textHead"
            android:cacheColorHint="#00000000"
            android:paddingLeft="25dip" >
        </ListView>

        <ListView
            android:id="@+id/lstRight"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:cacheColorHint="#00000000" >
        </ListView>

</RelativeLayout>
4

1 回答 1

1

给你Header View Layout和你的 idFooter View Layout然后为你的两者设置这些属性ListView's

<ListView
    android:id="@+id/lstRight"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_below="@+id/headerViewId"
    android:layout_above="@+id/footerViewId"
    android:cacheColorHint="#00000000" >
</ListView>
于 2012-07-04T12:16:30.603 回答