当前位置: 首页>>代码示例>>Java>>正文


Java AbsListViewDelegate类代码示例

本文整理汇总了Java中uk.co.senab.actionbarpulltorefresh.library.viewdelegates.AbsListViewDelegate的典型用法代码示例。如果您正苦于以下问题:Java AbsListViewDelegate类的具体用法?Java AbsListViewDelegate怎么用?Java AbsListViewDelegate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AbsListViewDelegate类属于uk.co.senab.actionbarpulltorefresh.library.viewdelegates包,在下文中一共展示了AbsListViewDelegate类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import uk.co.senab.actionbarpulltorefresh.library.viewdelegates.AbsListViewDelegate; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_gridview);

    GridView gridView = (GridView) findViewById(R.id.ptr_gridview);
    ListAdapter adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,
            ITEMS);
    gridView.setAdapter(adapter);

    // As we're modifying some of the options, create an instance of
    // PullToRefreshAttacher.Options
    PullToRefreshAttacher.Options ptrOptions = new PullToRefreshAttacher.Options();

    // Here we make the refresh scroll distance to 75% of the GridView height
    ptrOptions.refreshScrollDistance = 0.75f;

    // Here we define a custom header layout which will be inflated and used
    ptrOptions.headerLayout = R.layout.customised_header;

    // Here we define a custom header transformer which will alter the header based on the
    // current pull-to-refresh state
    ptrOptions.headerTransformer = new CustomisedHeaderTransformer();

    // Here we create a PullToRefreshAttacher manually with the Options instance created above.
    mPullToRefreshAttacher = PullToRefreshAttacher.get(this, ptrOptions);

    /**
     * As GridView is an AbsListView derived class, we create a new
     * AbsListViewDelegate instance. You do NOT need to do this if you're using
     * a supported scrollable Views. It is merely in this sample to show you how to set a
     * custom view delegate.
     */
    PullToRefreshAttacher.ViewDelegate handler = new AbsListViewDelegate();
    mPullToRefreshAttacher.addRefreshableView(gridView, handler, this);
}
 
开发者ID:HsingPeng,项目名称:ALLGO,代码行数:37,代码来源:GridViewActivity.java

示例2: onCreate

import uk.co.senab.actionbarpulltorefresh.library.viewdelegates.AbsListViewDelegate; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_gridview);

    GridView gridView = (GridView) findViewById(R.id.ptr_gridview);
    ListAdapter adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,
            ITEMS);
    gridView.setAdapter(adapter);

    // Now find the PullToRefreshLayout and set it up
    mPullToRefreshLayout = (PullToRefreshLayout) findViewById(R.id.ptr_layout);
    ActionBarPullToRefresh.from(this)
            .options(Options.create()
                    // Here we make the refresh scroll distance to 75% of the GridView height
                    .scrollDistance(.75f)
                    // Here we define a custom header layout which will be inflated and used
                    .headerLayout(R.layout.customised_header)
                    // Here we define a custom header transformer which will alter the header
                    // based on the current pull-to-refresh state
                    .headerTransformer(new CustomisedHeaderTransformer())
                    .build())
            .allChildrenArePullable()
            .listener(this)
            // Here we'll set a custom ViewDelegate
            .useViewDelegate(GridView.class, new AbsListViewDelegate())
            .setup(mPullToRefreshLayout);
}
 
开发者ID:Mobideck,项目名称:appdeck-android,代码行数:29,代码来源:GridViewActivity.java

示例3: onCreate

import uk.co.senab.actionbarpulltorefresh.library.viewdelegates.AbsListViewDelegate; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_gridview);

    GridView gridView = (GridView) findViewById(R.id.ptr_gridview);
    ListAdapter adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,
            ITEMS);
    gridView.setAdapter(adapter);

    // As we're modifying some of the options, create an instance of
    // PullToRefreshAttacher.Options
    PullToRefreshAttacher.Options ptrOptions = new PullToRefreshAttacher.Options();

    // Here we make the refresh scroll distance to 75% of the GridView height
    ptrOptions.refreshScrollDistance = 0.75f;

    // Here we customise the animations which are used when showing/hiding the header view
    ptrOptions.headerInAnimation = R.anim.slide_in_top;
    ptrOptions.headerOutAnimation = R.anim.slide_out_top;

    // Here we define a custom header layout which will be inflated and used
    ptrOptions.headerLayout = R.layout.customised_header;

    // Here we define a custom header transformer which will alter the header based on the
    // current pull-to-refresh state
    ptrOptions.headerTransformer = new CustomisedHeaderTransformer();

    // Here we create a PullToRefreshAttacher manually with the Options instance created above.
    mPullToRefreshAttacher = PullToRefreshAttacher.get(this, ptrOptions);

    /**
     * As GridView is an AbsListView derived class, we create a new
     * AbsListViewDelegate instance. You do NOT need to do this if you're using
     * a supported scrollable Views. It is merely in this sample to show you how to set a
     * custom view delegate.
     */
    PullToRefreshAttacher.ViewDelegate handler = new AbsListViewDelegate();
    mPullToRefreshAttacher.addRefreshableView(gridView, handler, this);
}
 
开发者ID:riaval,项目名称:open-note,代码行数:41,代码来源:GridViewActivity.java


注:本文中的uk.co.senab.actionbarpulltorefresh.library.viewdelegates.AbsListViewDelegate类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。