Note that there are some explanatory texts on larger screens.

plurals
  1. POAdding a Vertical Line to the SimpleCursorAdapter ListView
    primarykey
    data
    text
    <p>I have a ListView, and the list contain a Layout with View Component added to my RelativeLayout :</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;TextView android:id="@+id/no" android:layout_width="40dp" android:layout_height="40dp" android:layout_marginTop="5dp" android:layout_marginBottom="5dp" android:layout_marginLeft="10dp" android:layout_marginRight="5dp" android:gravity="center" /&gt; &lt;View android:id="@+id/line" android:layout_width="0.3dip" android:layout_height="wrap_content" android:layout_toRightOf="@+id/no" android:background="#FFdddddd" /&gt; &lt;TextView android:id="@+id/name" android:textColor="#150517" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@+id/line" android:layout_marginTop="15dp" android:layout_marginLeft="20dp" android:layout_marginRight="10dp" android:layout_gravity="right" android:layout_alignParentRight="true" android:gravity="right" android:textSize="38sp" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>code of MyCursorAdapter.java :</p> <pre><code> public class MyCursorAdapter extends SimpleCursorAdapter{ public MyCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to, int flags) { super(context, layout, c, from, to, flags); } @Override public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; if(position % 2 == 0){ view.setBackgroundColor(Color.rgb(243, 234, 214)); }else{ view.setBackgroundColor(Color.rgb(253, 247, 230)); } ((TextView)view.findViewById(R.id.name)).setTypeface(Typeface.createFromAsset(view.getContext().getAssets(), "fonts/nytype.ttf")); return view; } } </code></pre> <p>When i start to run my app. there is an errors messages :</p> <p>E/AndroidRuntime(19583): FATAL EXCEPTION: main</p> <p>E/AndroidRuntime(19583): java.lang.IllegalStateException: android.view.View is not a view that can be bounds by this SimpleCursorAdapter</p> <p>E/AndroidRuntime(19583): at android.support.v4.widget.SimpleCursorAdapter.bindView(SimpleCursorAdapter.java:145)</p> <p>How do i fix this problem?</p>
    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.
    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