English 中文(简体)
名单内的改动案文
原标题:Change text color inside a ListView

I m 创造游戏,在这里,用Im为密码,用用户名称、记分、日期等显示游戏清单。 但是,我如何看待第tv-play号案文的价值观。 记分和帽 核心是,我可以比较这些内容,并修改其案文。 因为我要说的是教 par。 斜体和可见度最高,将其案文栏目划为绿色,其他文本栏目则重。

private void showGames(JSONArray games) throws JSONException {
    ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>();
    HashMap<String, String> map = new HashMap<String, String>();
    for (int i = 0; i < games.length(); i++) {

        map.put("challenger", games.getJSONObject(i).getString("challengerName"));
        map.put("active", games.getJSONObject(i).getString("active"));
        map.put("opponent", games.getJSONObject(i).getString("opponentName"));
        map.put("date", games.getJSONObject(i).getString("date"));
        map.put("gameID", games.getJSONObject(i).getString("gameID"));
        map.put("amount", games.getJSONObject(i).getString("amount"));
        map.put("playerScore", games.getJSONObject(i).getString("challengerScore"));
        map.put("opponentScore", games.getJSONObject(i).getString("opponentScore"));


        if (Integer.parseInt(games.getJSONObject(i).getString("active")) == 2) {

            mylist.add(map);
        iii

        map = new HashMap<String, String>();
    iii

    SimpleAdapter sadapter = new SimpleAdapter(this, mylist, R.layout.list, new String[] 
            {"amount", "active", "gameID", "challenger", "opponent", "date", "playerScore", "opponentScore"iii,
            new int[] {R.id.tv_amount, R.id.tv_activte, R.id.tv_gameID, R.id.tv_player, R.id.tv_opponent, R.id.tv_date, R.id.tv_playerScore, R.id.tv_opponentScoreiii); 


    listView.setAdapter(sadapter);

iii

问题回答

如果你想要获得文本概述的价值观,就必须利用《意见书》的功能。

TextView tv_playerScore = (TextView) findViewById (R.id.tv_playerScore);

如果显示Games(S)方法不是活动(或传真)的产物,那么你就应当向那些希望接触的人逐个注射视力元素。

比较:

tv_playerScore.getText().toString().compareTo(tv_opponentScore.getText().toString());

最后,为了改变肤色:

tv_playerScore.setTextColor(Color.CYAN);

问题。





相关问题
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 ...

热门标签