English 中文(简体)
名单上新增加的物品
原标题:Animate newly added items in ListView

• 我如何将新添入的<代码>的项目合并起来。 清单

我有一个<代码>adapter,在我名单上增列新项目时,我说:adapter.notificationDataSetChanged();增列了这些物品,但一切都是完美的,但我想是新增加的内容来作一些估计。

问题回答

<代码>Animate 每添加以下内容:getView(, 您的Custompter

public View getView(int position, View convertView, ViewGroup parent) {

    View v = convertView;

    if (v == null) {
        LayoutInflater vi = (LayoutInflater) getActivity()
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        v = vi.inflate(R.layout.simple_list_item_1, null);
    }

    ListData o = list.get(position);
    TextView tt = (TextView) v.findViewById(R.id.toptext);

    tt.setText(o.content);

    Log.d("ListTest", "Position : "+position);
    if(flag == false) {
        Animation animation = AnimationUtils
                .loadAnimation(getActivity(), R.anim.slide_top_to_bottom);
        v.startAnimation(animation);
    }
    return v;
}

从而达到<代码>Animation。

官方关于安乐文的docs言说,在布局发生变化时,你可以采用“android:animateLayoutChanges=“true”,为触发。

http://developer.android.com/training/animation/layout.html。

增加这种估计比我最初想象的要困难。 这两种方式取决于你想要达到的那种估计。

这确实是一个黑体,但我发现的唯一途径是给<代码>添加一im。 子女:

You can try notifying the adapter the id of the item you are willing to delete and call adapter.notifyDataSetChanged();. This will generate calls to the adapter s getView() method. Inside it you can do something like:

if ( item.getId() == itemToRemove ) {
 //apply the animation
}

After the animation finished you can recall adapter.notifyDataSetChanged() to put everything in place.





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

热门标签