Android 水平listview标题文本动画

Android 水平listview标题文本动画,android,listview,scrollview,Android,Listview,Scrollview,有没有办法创建带有标题的水平列表视图。我认为水平列表视图可以通过HorizontalScrollView组件创建。如任务应用程序中所示(http://i.stack.imgur.com/qWZPh.jpg)我已经提供了,杂货店列表和工作标题都可以在杂货店列表中查看。当我从杂货店列表移动到工作时,标题也应该无缝移动。如何设置这样的标题动画(以便在滚动列表时放置标题) 谢谢 以下是免费任务应用程序的链接:任务应用程序(您发布的屏幕截图,实际上我每天都在使用)使用带有PagerTilleStrip的V

有没有办法创建带有标题的水平列表视图。我认为水平列表视图可以通过HorizontalScrollView组件创建。如任务应用程序中所示(http://i.stack.imgur.com/qWZPh.jpg)我已经提供了,杂货店列表和工作标题都可以在杂货店列表中查看。当我从杂货店列表移动到工作时,标题也应该无缝移动。如何设置这样的标题动画(以便在滚动列表时放置标题)

谢谢

以下是免费任务应用程序的链接:

任务
应用程序(您发布的屏幕截图,实际上我每天都在使用)使用带有PagerTilleStrip的ViewPager

如果您使用Eclipse,则会有一个默认选项来创建此类活动

当我选择“滑动视图+标题栏”时,Eclipse会自动生成以下XML代码

<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/pager"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

<!--
This title strip will display the currently visible page title, as well as the page
titles for adjacent pages.
-->
<android.support.v4.view.PagerTitleStrip android:id="@+id/pager_title_strip"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="top"
    android:background="#33b5e5"
    android:textColor="#fff"
    android:paddingTop="4dp"
    android:paddingBottom="4dp" />

谢谢你的回复。是否可以在API 8级别上执行此操作?当我尝试创建活动时,它至少需要14个SDK版本。任务应用程序的最低要求也是8(android 2.2)。@user1587263尝试使用ActionBarSherlock。它支持Android 2.X.@user1587263下载ActionBarSherlock的示例代码,并尝试找到可以开始编码的示例。
package com.example.test;

import android.app.ActionBar;
import android.app.FragmentTransaction;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.NavUtils;
import android.support.v4.view.ViewPager;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class MainActivity extends FragmentActivity {

    /**
     * The {@link android.support.v4.view.PagerAdapter} that will provide fragments for each of the
     * sections. We use a {@link android.support.v4.app.FragmentPagerAdapter} derivative, which will
     * keep every loaded fragment in memory. If this becomes too memory intensive, it may be best
     * to switch to a {@link android.support.v4.app.FragmentStatePagerAdapter}.
     */
    SectionsPagerAdapter mSectionsPagerAdapter;

    /**
     * The {@link ViewPager} that will host the section contents.
     */
    ViewPager mViewPager;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        // Create the adapter that will return a fragment for each of the three primary sections
        // of the app.
        mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());


        // Set up the ViewPager with the sections adapter.
        mViewPager = (ViewPager) findViewById(R.id.pager);
        mViewPager.setAdapter(mSectionsPagerAdapter);

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }        

    /**
     * A {@link FragmentPagerAdapter} that returns a fragment corresponding to one of the primary
     * sections of the app.
     */
    public class SectionsPagerAdapter extends FragmentPagerAdapter {

        public SectionsPagerAdapter(FragmentManager fm) {
            super(fm);
        }

        @Override
        public Fragment getItem(int i) {
            Fragment fragment = new DummySectionFragment();
            Bundle args = new Bundle();
            args.putInt(DummySectionFragment.ARG_SECTION_NUMBER, i + 1);
            fragment.setArguments(args);
            return fragment;
        }

        @Override
        public int getCount() {
            return 3;
        }

        @Override
        public CharSequence getPageTitle(int position) {
            switch (position) {
                case 0: return getString(R.string.title_section1).toUpperCase();
                case 1: return getString(R.string.title_section2).toUpperCase();
                case 2: return getString(R.string.title_section3).toUpperCase();
            }
            return null;
        }
    }

    /**
     * A dummy fragment representing a section of the app, but that simply displays dummy text.
     */
    public static class DummySectionFragment extends Fragment {
        public DummySectionFragment() {
        }

        public static final String ARG_SECTION_NUMBER = "section_number";

        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                Bundle savedInstanceState) {
            TextView textView = new TextView(getActivity());
            textView.setGravity(Gravity.CENTER);
            Bundle args = getArguments();
            textView.setText(Integer.toString(args.getInt(ARG_SECTION_NUMBER)));
            return textView;
        }
    }
}