this is my first time posting a question here and so please, pardon my mistakes. I am currently working on an Android app and I am fairly new to it. In my main activity, I have a image background and three buttons. The third button's action listener creates an intent and starts a new activity which is a custom multi-column list view.
The problem is that when the listview activity starts and becomes visible, the main activity image background and the three buttons on it become background of the listview activity (the three buttons are not interactive). I can see the rows of the list view just fine. I am not sure what I would change to get rid of the main activity from the background of the listview activity. I have tried to search on the web if anyone else faced this problem but couldn't find anything relevant. Please let me know if I can further explain anything if not clear. Thanks Here are my layout files: Main Activity Layout Definition:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/clock_1"
android:orientation="vertical" >
<TextView
android:id="@+id/tvStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:text="@string/tvStatus"
android:textColor="#000000"
android:textSize="20sp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="@+id/btnClockIn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:text="@string/btnClockIn"
android:textColor="#000000" />
<Button
android:id="@+id/btnClockOut"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/btnClockIn"
android:layout_centerHorizontal="true"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:text="@string/btnClockOut"
android:textColor="#000000" />
<Button
android:id="@+id/btnViewHours"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/btnClockOut"
android:layout_centerHorizontal="true"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:text="@string/btnViewHours"
android:textColor="#000000" />
</RelativeLayout>
</LinearLayout>
ListView Row Layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/listViewLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:id="@+id/displayClockIn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="@string/displayTimeIn"
android:textColor="#000000" >
</TextView>
<TextView
android:id="@+id/displayClockOut"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="@string/displayTimeOut"
android:textColor="#000000" >
</TextView>
<TextView
android:id="@+id/displayHours"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/displayHours"
android:textColor="#000000" >
</TextView>
</LinearLayout>
Second Activity (ListView) 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">
<ListView
android:id="@+id/listView"
android:layout_height="wrap_content"
android:layout_width="match_parent">
</ListView>
</LinearLayout>
Below is how I have written my listener for the button that takes me to the second activity:
final Button btnViewHours = (Button) findViewById(R.id.btnViewHours);
btnViewHours.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View the_view) {
Intent intent = new Intent(MainActivity.this, ViewHoursActivity.class);
startActivity(intent);
}
});