欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  技术分享

Android高仿京东分类_类似京东分类界面源代码下载

程序员文章站 2022-03-01 12:53:38
...

本Demo是一款类似京东分类的例子、效果非常不错、左边使用的一个ScrollView嵌套的动态View、右边是一个ViewPager用来显示只分类的Fragment、Fragment可以左右滑动、滑动并可以直接更新父分类、并富有动画效果

Android高仿京东分类_类似京东分类界面源代码下载


动态生成显示items中的textview

private void showToolsView() {
    toolsList=new String[]{"常用分类","潮流女装","品牌男装","内衣配饰",
        "家用电器","手机数码","电脑办公","个护化妆","母婴频道","食物生鲜",
        "酒水饮料","家居家纺","整车车品","鞋靴箱包","运动户外","图书",
        "玩具乐器","钟表","居家生活","珠宝饰品","音像制品","家具建材",
        "计生情趣","营养保健","奢侈礼品","生活服务","旅游出行"};
    LinearLayout toolsLayout=(LinearLayout) findViewById(R.id.tools);
    toolsTextViews=new TextView[toolsList.length];
    views=new View[toolsList.length];
    
    for (int i = 0; i < toolsList.length; i  ) {
        View view=inflater.inflate(R.layout.item_b_top_nav_layout, null);
        view.setId(i);
        view.setOnClickListener(toolsItemListener);
        TextView textView=(TextView) view.findViewById(R.id.text);
        textView.setText(toolsList[i]);
        toolsLayout.addView(view);
        toolsTextViews[i]=textView;
        views[i]=view;
    }
    changeTextColor(0);
}


创建二极分类

public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_pro_type, null);
    progressBar=(ProgressBar) view.findViewById(R.id.progressBar);
    hint_img=(ImageView) view.findViewById(R.id.hint_img);
    listView = (GridView) view.findViewById(R.id.listView);
    typename=getArguments().getString("typename");
    ((TextView)view.findViewById(R.id.toptype)).setText(typename);
    GetTypeList();
    adapter=new Pro_type_adapter(getActivity(), list);
    listView.setAdapter(adapter);
    listView.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,long arg3) {
            
        }
    });
    
    return view;
}


最后给贴上Demo的源代码、希望对大家有用、有兴趣的哥们可以下载看看

源代码下载链接: http://dwtedx.com/download.html?bdkey=s/1eQfNaMm 密码: wc9j