0

I have an activity layout consisting of just a ListView. It is supposed to use a list format xml which consists of a custom shape with three TextViews inside. In code I populate the ListView with the desired text, and when I run the app on an AVD, everything works as planned. When I deploy to my Droid Razr, however, the entire screen is blank when I run that activity.

Edit: Added code below

This is my custom shape (drawable):

<stroke
    android:width="1dp"
    android:color="#ff9f9f9f" />

<padding
    android:bottom="20dp"
    android:left="20dp"
    android:right="20dp"
    android:top="20dp" />

<solid
    android:color="@color/white" />

<corners
    android:bottomLeftRadius="7dp"
    android:bottomRightRadius="7dp"
    android:topLeftRadius="7dp"
    android:topRightRadius="7dp" />

This is my list format:

<?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="?android:attr/listPreferredItemHeight"
android:background="@drawable/rounded_edges"
android:orientation="vertical"
android:padding="6dip"
android:theme="@android:style/Theme.Holo.Light" >

<TextView
    android:id="@+id/details_list_title"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="6dp"
    android:layout_marginRight="6dp"
    android:layout_weight="1"
    android:textAppearance="?android:attr/textAppearanceLarge" />

And this is how I use it in code:

        ListView listView = (ListView) findViewById(R.id.event_details_listView);
    DetailAdapter adapter = new DetailAdapter(this, R.layout.listformat_event_details, details);
    listView.setAdapter(adapter);

Where details is an ArrayList> of my text. DetailAdapter has a getView method which adds text to the textview and inflates the layout.

Descartes
  • 503
  • 2
  • 7
  • 22
  • Odd issue, but more details are needed. AVD vs Droid Android Version Anything in LogCat? What does your code look like? – A--C Feb 13 '13 at 00:43
  • The AVD says it's Android 4.1 and my phone is 4.0.4. But I don't think I used anything that's 4.1-specific. No force closes or errors/warnings in logcat – Descartes Feb 13 '13 at 00:45
  • Please post code this will help a lot. – Chris.Jenkins Feb 13 '13 at 00:54

2 Answers2

0

I believe the problem may be with the <corners /> tag, which can be a bit buggy; such as the bottomRightRadius and bottomLeftRadius properties are reversed.

You can try using <corners android:radius="7dp"/> instead.

android: shape corners do not work when setting individual corners

Android - Can't create simple rectangle shape... UnsupportedOperationException?

Community
  • 1
  • 1
CodeShane
  • 6,480
  • 1
  • 18
  • 24
  • Thanks for your response but this didn't seem to change anything. I also tried changing the padding size of the shape – Descartes Feb 13 '13 at 14:23
0

I was able to fix the problem by refreshing the Detail Adapter more frequently; apparently the lag in the emulator was enough time for the views to compute but the physical device was too fast.

Descartes
  • 503
  • 2
  • 7
  • 22