My ListView is currently stuck in a little small view-box on the bottom of my screen. When it's clicked, I want it to expand to some height. I've read guides on here on how to do that, but nothing seems to work. Here's my code here.
list.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Log.v("Miles", "Listview clicked");
LayoutParams adapterParams = (LayoutParams) parent.getLayoutParams();
adapterParams.height = 400;
parent.setLayoutParams(adapterParams);
}
});
And the layout that this code snippet is happening in:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="tribeTimes.EventFragment"
android:focusable="true"
android:focusableInTouchMode="true" >
<TextView
android:id="@+id/event"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:background="@drawable/buttonborder_selector"
android:id="@+id/likes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/event"
android:layout_marginBottom="20dp"
android:clickable="true"
android:gravity="center"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:background="@drawable/buttonborder_selector"
android:hint="@string/yourComment"
android:id="@+id/yourComment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/likes"
android:layout_marginBottom="20dp"
android:gravity="left"
android:inputType="text" >
<requestFocus/>
</EditText>
<ListView
android:layout_below="@id/yourComment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/listInParent" >
</ListView>
</RelativeLayout>