English 中文(简体)
清单调查中的标语
原标题:Strikethough text in listview?
  • 时间:2010-08-23 17:50:07
  •  标签:
  • android

我在提出一个清单和一个问题I m正面临时,我无法说明我为什么在一份清单中点击某一项目时,那一行的案文会产生罢工效应。 我知道我应该说:

TextView text = (TextView)view.findViewById(android.R.id.text);
text.setPaintFlags(text1.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);

I m打着onListItemClick,但在我点击某一项目时坠毁。 任何建议?

最佳回答

在我工作守则之后,联系信息作为清单显示,在清单项目被点击时,打上了联系名称。

添加“Rodid.permission.READ_CONTACTS”的许可,以测试以下代码。

public class MyListActivity extends ListActivity {
/** Called when the activity is first created. */

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    String[] projection={ContactsContract.Contacts.DISPLAY_NAME,ContactsContract.Contacts._ID};
    int[] to={android.R.id.text1,android.R.id.text2};
    Cursor c=getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, projection, null, null, null);
    setListAdapter(new SimpleCursorAdapter(this,android.R.layout.simple_list_item_2,c,projection,to));
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);
    TextView tv=(TextView) v.findViewById(android.R.id.text1);
    tv.setPaintFlags(tv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
}
}

我看不到第8级的“Rodid.R.id.text”资源,或许你需要在你的法典中加以纠正。

PS:修改文本审查财产是不正确的,因为意见按框架回收,没有保证每个清单项目有单独的观点。 理想的办法是,根据现有清单项目的储存状态,储存需要经过打击的清单上项目的位置,并采用压倒性听器的方式,设定正确的油漆旗。

问题回答

暂无回答




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签