zoukankan      html  css  js  c++  java
  • android 仿网易新闻首页框架

      

    实现思路很简单左侧栏目是一个一个的 Fragment 的,点击时动态替换各个 Fragment 到当前 Activity 中。

    关键代码:

    public void loadFragment(Map<String, Object> map) {
            if (map == null) {
                return;
            }
    
            try {
                getSlidingMenu().toggle();
    
                String title = (String) map.get("title");
    
                if (currentTitle == null || !currentTitle.equals(title)) {
                    currentTitle = title;
                    // set title
                    this.title.setText(title);
    
                    Class<?> cls = (Class<?>) map.get("class");
                    String tag = (String) map.get("tag");
                    Fragment fragment = (Fragment) cls.newInstance();
                    // Insert the fragment by replacing any existing fragment
                    FragmentManager fragmentManager = getSupportFragmentManager();
                    fragmentManager.beginTransaction()
                            .replace(R.id.fragment_content, fragment, tag).commit();
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

    首页布局:

    1 SliddingMenu  +  ViewPagerIndicator

    2 JSON 解析   FastJson

    3 网络请求  Volley

    4 sqlite 数据库简单封装,主要处理数据库版本升级问题

    5 微信、微博 API 简单封装

    6 代码混淆

    。。。。。。

    github: https://github.com/lesliebeijing/MyAndroidFramework.git

  • 相关阅读:
    FileZilla 双向传输
    移动端弱网测试工具
    来源IP安全分析,对IP溯源
    推荐几款移动端抓包小工具
    一键清除Chrome
    resit阶段二
    redist集群
    redits04 快照配置
    ridts08管理工具
    redits07配置文件
  • 原文地址:https://www.cnblogs.com/lesliefang/p/3952334.html
Copyright © 2011-2022 走看看