cc美团商家界面加上SlidePage开源项目

发布时间:2020-08-02 07:41:17 作者:愚人cc
来源:网络 阅读:525

cc美团商家界面加上SlidePage开源项目

1. 

package com.chencheng.meituan.fragment;


import com.astuetz.PagerSlidingTabStrip;

import com.chencheng.meituan.view.MapOverLayActivity;

import com.yuchen.meituan.R;

import com.yuchen.meituan.R.layout;


import android.content.Intent;

import android.os.Bundle;

import android.support.v4.app.Fragment;

import android.support.v4.app.FragmentManager;

import android.support.v4.app.FragmentPagerAdapter;

import android.support.v4.view.ViewPager;

import android.view.LayoutInflater;

import android.view.View;

import android.view.View.OnClickListener;

import android.view.ViewGroup;


/**

 * A simple {@link Fragment} subclass.

 *

 */

public class Shop0Fragment extends Fragment implements OnClickListener {


private final String[] TITLES = { "全部商家", "优惠商家"};

public Shop0Fragment() {

// Required empty public constructor

}


@Override

public View onCreateView(LayoutInflater inflater, ViewGroup container,

Bundle savedInstanceState) {

View layout = inflater.inflate(R.layout.fragment_shop0, null);

layout.findViewById(R.id.rl_map_btn).setOnClickListener(this);

initViewPager(layout);

return layout;

}


private void initViewPager(View layout) {

ViewPager mPager = (ViewPager) layout.findViewById(R.id.pager);

PagerSlidingTabStrip tabStrip = (PagerSlidingTabStrip) layout.findViewById(R.id.tabs);

FragmentManager fm = getChildFragmentManager();

mPager.setAdapter(new BannerPagerAdapger(fm));

tabStrip.setViewPager(mPager);

}





class BannerPagerAdapger extends FragmentPagerAdapter {


public BannerPagerAdapger(FragmentManager fm) {

super(fm);

}


@Override

public CharSequence getPageTitle(int position) {

return TITLES[position];

}


public Fragment getItem(int position) {

int i =position%2;

Fragment fragment;

if(i==0){

fragment = new ShopFragment();

}else{

fragment=new ShopFragment();

}

//fragment.setTitle(TITLES[position]);

return fragment;

}

public int getCount() {

return TITLES.length;

}


}





@Override

public void onClick(View v) {

switch (v.getId()) {

case R.id.rl_map_btn:

//周边

startActivity(new Intent(getActivity(), MapOverLayActivity.class));

break;


default:

break;

}

}



}


2.修改库PagerSlidingTabStrip里面indicator 和  underline的属性



private int indicatorColor = 0xFF22B14C;

private int underlineColor = 0x1A22B14C;

private int dividerColor = 0x00E61A5F;


private boolean shouldExpand = false;

private boolean textAllCaps = true;


private int scrollOffset = 52;

private int indicatorHeight = 2;

private int underlineHeight = 4;

private int dividerPadding = 2;

private int tabPadding = 24;

private int dividerWidth = 2;


private int tabTextSize = 12;

private int tabTextColor = 0xFF22B14C;


推荐阅读:
  1. cc美团 滑动删除(SwipeListView)
  2. cc_美团 评论使用GitHut水平条开源项目事项

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

cc美团商家界面加上slidepage开 age

上一篇:mariadb在Centos8/redhat8中libncurses.so.5找不到的问题

下一篇:Devexpress报表开发(四):向报表中添加一个参数

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》