Note that there are some explanatory texts on larger screens.

plurals
  1. POandroid listview row takes up full height
    primarykey
    data
    text
    <p>I have a relativelayout view for use with a listview. For some reason, even though I have set <code>layout_height</code> to <code>wrap_content</code>, the layout is taking up all the space it can. The result is that every row in the list is as tall as the screen!</p> <p>I am not sure what is wrong with the view. It used to work just fine.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/cloudbkg" &gt; &lt;ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:src="@drawable/pay" /&gt; &lt;LinearLayout android:id="@+id/linearLayout1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_toRightOf="@+id/imageView1" android:orientation="vertical" &gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ellipsize="end" android:singleLine="true" android:text="Medium Text" android:textAppearance="?android:attr/textAppearanceMedium" /&gt; &lt;TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TextView" /&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:id="@+id/linearLayout2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:orientation="vertical" &gt; &lt;TextView android:id="@+id/textView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="right" android:text="Small Text" android:textAppearance="?android:attr/textAppearanceSmall" /&gt; &lt;TextView android:id="@+id/textView4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Large Text" android:textAppearance="?android:attr/textAppearanceLarge" /&gt; &lt;/LinearLayout&gt; &lt;/RelativeLayout&gt; </code></pre> <p>Here is the getView function.</p> <pre><code>public View getView(final int position, View convertView, ViewGroup parent) { if (convertView == null) { try { final JSONObject holder = getItem(position); convertView = inflateView(R.layout.dumb); convertView.setOnClickListener(new OnClickListener() { public void onClick(View v) { try { Intent i = new Intent(context, Pending.class); i.putExtra("id", holder.getString("_id")); context.startActivity(i); } catch(Throwable e){ e.printStackTrace(); } } }); convertView.setOnLongClickListener(new OnLongClickListener(){ public boolean onLongClick(View v){ try { final CharSequence[] items = {"Pay", "Delete"}; AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(holder.getString("service")); builder.setItems(items, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { } }).create().show(); } catch(Throwable e){ e.printStackTrace(); } return true; } }); TextView t = (TextView)convertView.findViewById(R.id.amount); t.setText(holder.getString("currency") + holder.getString("amount")); setImg((ImageView)convertView.findViewById(R.id.pic), holder.getJSONObject("to").getString("pic")); t = (TextView) convertView.findViewById(R.id.time); t.setText(DateUtils.getRelativeTimeSpanString(holder.getLong("time")*1000, System.currentTimeMillis(), 0, DateUtils.FORMAT_ABBREV_ALL)); t = (TextView) convertView.findViewById(R.id.service); t.setText(holder.getString("service")); // url, co-ords, or shop } catch(Throwable e) { e.printStackTrace(); } } return convertView; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload