Header and footer always visible in event list activity instead of being a part of the list.

This commit is contained in:
Robert Kolner committed 2011-09-14 17:57:50 +02:00
1 parent 7b8aa8d5e9
commit 9c16bbfa57
2 files changed
+28 -24

No files matched your search

+20 -7
View File
@@ -1,14 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<!-- Header -->
<include layout="@layout/header" android:id="@+id/header"
android:layout_height="80dip" android:layout_width="fill_parent" />
<!-- Header -->
<include
layout="@layout/header"
android:id="@+id/header"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_alignParentTop="true" />
<!-- Program list (Added in Java.) -->
<!-- Footer -->
<include layout="@layout/footer" android:id="@+id/footer" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:layout_alignParentBottom="true" />
<include
layout="@layout/footer"
android:id="@+id/footer"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_alignParentBottom="true" />
<!-- Program list -->
<ListView android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/header"
android:layout_above="@id/footer" />
</RelativeLayout>
@@ -2,19 +2,17 @@ package com.studentersamfundet.app.ui;
import org.w3c.dom.NodeList;
import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.Toast;
import com.studentersamfundet.app.DataHandler;
import com.studentersamfundet.app.FeedFetcher;
import com.studentersamfundet.app.R;
import com.studentersamfundet.app.XmlParser;
import android.app.ListActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.Toast;
public class ProgramList extends ListActivity {
public static final String feedURL = "http://folk.uio.no/larsjeng/test.xml";
public static final String localURL = "/data/com.studentersamfundet.app/files/dns_events";
@@ -25,7 +23,7 @@ public class ProgramList extends ListActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView(R.layout.event_list);
setContentView(R.layout.event_list);
// View v = this.findViewById(R.id.program_button);
// v.setClickable(false);
@@ -43,14 +41,7 @@ public class ProgramList extends ListActivity {
Toast toast = Toast.makeText(this, R.string.error_noconnection_noupdate, Toast.LENGTH_LONG);
toast.show();
}
View header = getLayoutInflater().inflate(R.layout.header, null);
View footer = getLayoutInflater().inflate(R.layout.footer, null);
ListView listView = getListView();
listView.addHeaderView(header);
listView.addFooterView(footer);
ListAdapter adapter = createAdapter();
setListAdapter(adapter);
}