Note that there are some explanatory texts on larger screens.

plurals
  1. POMarquee not work in custom ListView
    primarykey
    data
    text
    <p>I tried all solutions on StackOverflow but it doesn't work. Each ListView item includes a TextView and a CheckBox as described below. The text in TextView shows one line but doesn't marquee. The strange thing is when I include the line "android:ellipsize=marquee", the CheckBox works wrongly. I mean when I touch checkBox A, it checks B or C! If I exclude that line, it runs well but not marquee. Please help, I'm crazy with it in many hours. :(</p> <p>Figure <img src="https://i.stack.imgur.com/OmRdq.png" alt="enter image description here"></p> <p>This is textview_checkbox_row.xml </p> <pre><code>&lt;TextView android:layout_weight="1" android:id="@+id/dictionaryName" android:layout_height="wrap_content" android:layout_width="match_parent" android:text="This is sample text." android:layout_gravity="center_vertical" android:layout_marginLeft="5dip" style="@style/DreamTextView" android:ellipsize="marquee" android:lines="1" android:focusable="true" android:focusableInTouchMode="true" android:singleLine="true" android:scrollHorizontally="true" android:freezesText="true" /&gt; &lt;CheckBox android:layout_weight="0" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/dictionaryEnabled" android:layout_marginRight="5dip" android:layout_marginLeft="5dip" android:layout_gravity="center_vertical" /&gt; </code></pre> <p></p> <p>Code for ResourceCursorAdapter</p> <pre><code>public class ChosenDictionaryCheckBoxAdapter extends ResourceCursorAdapter { private final LayoutInflater inflater; public ChosenDictionaryCheckBoxAdapter(final Context context, final Cursor cursor) { super(context, R.layout.textview_checkbox_row, cursor, true); this.inflater = LayoutInflater.from(context); } private static class ViewHolder { private TextView dictName; private CheckBox dictEnabled; } @Override public View newView(final Context context, final Cursor cursor, final ViewGroup parent) { final View view = inflater.inflate(R.layout.textview_checkbox_row, parent, false); // Create view holder and store it. final ViewHolder viewHolder = new ViewHolder(); viewHolder.dictName = (TextView) view.findViewById(R.id.dictionaryName); viewHolder.dictEnabled = (CheckBox) view.findViewById(R.id.dictionaryEnabled); view.setTag(viewHolder); viewHolder.dictEnabled.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) { final int dictID = (Integer) buttonView.getTag(); // Update database. final ContentValues value = new ContentValues(); value.put(ChosenModel.ENABLED_COLUMN, isChecked ? 1 : 0); final String where = ChosenModel.ID_COLUMN + " = " + dictID; final SQLiteDatabase database = DatabaseHelper.getDatabase(context); database.update(ChosenModel.TABLE_NAME, value, where, null); // NEED IMPROVE THIS USE // THIS IS NOT GOOD // cursor.requery(); } }); return view; } @Override public void bindView(final View view, final Context context, final Cursor cursor) { final ViewHolder viewHolder = (ViewHolder) view.getTag(); // Populate the elements of list item. viewHolder.dictEnabled.setTag(cursor.getInt(cursor.getColumnIndex(ChosenModel.ID_COLUMN))); viewHolder.dictName.setText(cursor.getString(cursor.getColumnIndex(ChosenModel.DICTIONARY_NAME_COLUMN))); viewHolder.dictEnabled.setChecked(cursor.getInt(cursor.getColumnIndex(ChosenModel.ENABLED_COLUMN)) == 0 ? false : true); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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