Hi, i'm new to Android and having a lot of trouble displaying a Button and a EditBox after a Listview. I've attached a sample paint image of what i'm trying to achieve and included my code below.
Any help would be appreciated.
Thanks
My XML File:
My Code so far:
Any help would be appreciated.
Thanks

My XML File:
Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<TextView
android:id="@+id/selection"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"/>
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon"/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<EditText android:id="@+id/edittext"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="add text"/>
<Button
android:id="@+id/btn_search"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Search"/>
</LinearLayout>
</LinearLayout>
My Code so far:
Code:
public class recipes extends ListActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
main_array = getResources().getStringArray(R.array.main_array);
setListAdapter(new MyCustomAdapter(recipes.this, R.layout.row, main_array));
}
public void onListItemClick(ListView parent, View v, int position, long id){
Intent intent = new Intent(v.getContext(), Activity2.class);
intent.putExtra("selected_item", position);
intent.putExtra("selected_name", main_array[position]);
startActivityForResult(intent, 0);
}
public class MyCustomAdapter extends ArrayAdapter<String> {
public MyCustomAdapter(Context context, int textViewResourceId, String[] objects) {
super(context, textViewResourceId, objects);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater=getLayoutInflater();
View row = inflater.inflate(R.layout.row, parent, false);
TextView selection = (TextView)row.findViewById(R.id.selection);
selection.setText(recipes.main_array[position]);
ImageView image =(ImageView)row.findViewById(R.id.icon);
return row;
}
}
}