I'll put the actual question here, so it doesn't get lost in the text and code.... I'm hoping someone here can see what my (damaged) vision is refusing to see, specifically, why I get blank rows in my custom listview instead of the stuff that's supposed to be there.
I'm trying to do a custom listview that should look something like this: .-------------------------------------------. | [/] Deposit Amount: $ 500.00 | | (Misc.) New balance: $2015.44 | `-------------------------------------------' where the [/] is a checkbox, and the dollar amounts are from variables. The problem is, with some fake test data, all I see is this: .-------------------------------------------. | | | | |-------------------------------------------| | | | | |-------------------------------------------| | | | | |-------------------------------------------| | | | | `-------------------------------------------' I've gone through my code and the tutorial code line by line at least three or four times, and yet, I'm still missing something. Given the damage done to my occipital lobe during my first cancer, that's not difficult to believe (2.5 cm tumor in my left occipital lobe (plus two others in the front of my brain), followed by three brain surgeries, followed by by whole-brain/max dose radiation and extremely harsh chemo ... my vision has a tendency sometimes to see what it thinks should be there instead of what IS there. I think that's what's happening when I try to find what I missed or just got wrong. I've played around with white text on black, black text on white, and even blue text on black or white. Nothing...just blank rows. Just to make sure it's not one device, I've tested this on my phone (Samsung Galaxy Note 4 running Android 5.01), my tablet (LG G Pad 7.0 LTE running Android 4.4.2) and on the emulator. The only changes there is the darkness of the borders. Oh, I've also tried building it with Eclipse and Android Studio (not that that should make any difference, except that Eclipse seems to have gotten really buggy lately---so I switched to AS). The code I have so far is a test adapted from a tutorial at http://tinyurl.com/p7uxbcp and is as follows: activity_main.xml --------------------------- CUT HERE --------------------------- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#FFFFFF"> <ListView android:id="@+id/listView1" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </LinearLayout> --------------------------- CUT HERE --------------------------- listview_header_row.xml --------------------------- CUT HERE --------------------------- <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:id="@+id/txtHeader" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center_vertical" android:layout_alignParentTop="true" android:layout_alignParentBottom="true" android:textStyle="bold" android:textSize="18dp" android:textColor="#FFFFFF" android:padding="10dp" android:text="My Credit Union" android:background="#336699" /> </LinearLayout> --------------------------- CUT HERE --------------------------- listview_item_row.xml --------------------------- CUT HERE --------------------------- <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="10dp"> <CheckBox android:id="@+id/chkAndroid" android:layout_width="4sp" android:layout_height="4sp" /> <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:id="@+id/DescriptionTV" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:textStyle="bold" android:textSize="14dp" android:background="#000000" android:textColor="#FFFFFF" /> <TextView android:id="@+id/AmountTV" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignParentTop="true" android:layout_alignParentRight="true" android:textStyle="bold" android:textSize="14dp" android:background="#000000" android:textColor="#FFFFFF" /> <TextView android:id="@+id/DateTV" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_below="@id/DescriptionTV" android:layout_alignParentLeft="true" android:textSize="10dp" android:background="#000000" android:textColor="#FFFFFF" /> <TextView android:id="@+id/BalanceTV" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_below="@id/AmountTV" android:layout_alignParentRight="true" android:textSize="10dp" android:background="#000000" android:textColor="#FFFFFF" /> </RelativeLayout> </LinearLayout> --------------------------- CUT HERE --------------------------- MainActivity.java --------------------------- CUT HERE --------------------------- package com.jdgapps.listViewTest; import android.app.Activity; import android.app.ActivityManager; import android.content.Context; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.AdapterView; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.CheckBox; import android.widget.RelativeLayout; import android.widget.LinearLayout; public class MainActivity extends Activity { private ListView listView1; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Detail detail[] = new Detail[] { new Detail("Deposit", "04/19/15", 100000000.00, 100000000.00), new Detail("Hunting Land", "04/19/15", 5000.00, 99995000.00), new Detail(".50 cal AR", "04/20/15", 2000.00, 99993000.00), new Detail("Build House", "04/20/15", 200000.00, 99793000.00), }; DetailAdapter adapter = new DetailAdapter(this, R.layout.listview_item_row, detail); listView1 = (ListView)findViewById(R.id.listView1); View header = (View)getLayoutInflater().inflate(R.layout.listview_header_row, null); listView1.addHeaderView(header); listView1.setAdapter(adapter); } } --------------------------- CUT HERE --------------------------- Detail.java --------------------------- CUT HERE --------------------------- package com.jdgapps.listViewTest; import android.app.Activity; import android.app.ActivityManager; import android.content.Context; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.AdapterView; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.RelativeLayout; import android.widget.LinearLayout; public class Detail { public String description, date; public double balance, amount; public boolean cleared = false; public Detail() { super(); } public Detail(String description, String date, double balance, double amount) { super(); this.description = description; this.date = date; this.balance = balance; this.amount = amount; } } --------------------------- CUT HERE --------------------------- DetailAdapter.java --------------------------- CUT HERE --------------------------- package com.jdgapps.listViewTest; import com.jdgapps.listViewTest.Detail; import android.app.Activity; import android.app.ActivityManager; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import android.widget.CheckBox; public class DetailAdapter extends ArrayAdapter<Detail>{ Context context; int layoutResourceId; Detail data[] = null; public DetailAdapter(Context context, int layoutResourceId, Detail[] data) { super(context, layoutResourceId, data); this.layoutResourceId = layoutResourceId; this.context = context; this.data = data; } @Override public View getView(int position, View convertView, ViewGroup parent) { View row = convertView; DetailHolder holder = null; if(row == null) { LayoutInflater inflater = ((Activity)context).getLayoutInflater(); row = inflater.inflate(layoutResourceId, parent, false); holder = new DetailHolder(); holder.DescriptionTV = (TextView)row.findViewById(R.id.DescriptionTV); holder.AmountTV = (TextView)row.findViewById(R.id.AmountTV); holder.DateTV = (TextView)row.findViewById(R.id.DateTV); holder.BalanceTV = (TextView)row.findViewById(R.id.BalanceTV); row.setTag(holder); } else { holder = (DetailHolder)row.getTag(); } Detail detail = data[position]; holder.DescriptionTV = (TextView)row.findViewById(R.id.DescriptionTV); holder.AmountTV = (TextView)row.findViewById(R.id.AmountTV); holder.DateTV = (TextView)row.findViewById(R.id.DateTV); holder.BalanceTV = (TextView)row.findViewById(R.id.BalanceTV); return row; } static class DetailHolder { TextView DescriptionTV; TextView AmountTV; TextView DateTV; TextView BalanceTV; } } --------------------------- CUT HERE --------------------------- Can anyone see what's missing? Like I said, wit -- THE SCORE: ME: 2 CANCER: 0 http://fineartamerica.com/profiles/4-james-graham.html 73 DE N5IAL (/4) | AN EXCERCISE is a situation in which you stop what [email protected] | you're doing in order to simulate doing what you < Running Mac OS X Lion > | were doing so you can show someone else that you ICBM / Hurricane: | can simulate what you were doing as well as you 30.44406N 86.59909W | were doing it before you were interrupted. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

