Issue
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.
Solution
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.
Answered By - Descartes
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.