zoukankan      html  css  js  c++  java
  • 团队冲刺06

    团队冲刺06

    今天遇到了很多的问题,有的通过查资料已经解决了,但是主要的还没有解决,太难了

    成果展示:

    package fragment;
    
    import android.app.Fragment;
    import android.os.Bundle;
    import android.support.annotation.Nullable;
    import android.view.LayoutInflater;
    import android.view.View;
    import android.view.ViewGroup;
    
    import com.example.animator.knowledge_circle.R;
    
    /**
     * Created by animator on 2020/4/5.
     */
    public class ConditionFragment extends Fragment {
        @Nullable
        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
            View view = inflater.inflate(R.layout.fragment_by_condition,null);
            return view;
        }
    }
    package fragment;
    
    import android.app.Fragment;
    import android.app.FragmentManager;
    import android.app.FragmentTransaction;
    import android.graphics.Color;
    import android.os.Bundle;
    import android.support.annotation.Nullable;
    import android.view.LayoutInflater;
    import android.view.View;
    import android.view.ViewGroup;
    import android.widget.LinearLayout;
    
    import com.example.animator.knowledge_circle.R;
    
    /**
     * Created by animator on 2020/4/5.
     */
    public class MessageFragment extends Fragment {
        LinearLayout l1,l2;
        View down1,down2;
        @Nullable
        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
            View view = inflater.inflate(R.layout.fragment_message,null);
            Fragment fragment = new ConditionFragment();
            FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
            fragmentTransaction.add(R.id.fragment_dy_condition, fragment);
            fragmentTransaction.commit();
            l1 = (LinearLayout) view.findViewById(R.id.message_l1);
            l2 = (LinearLayout) view.findViewById(R.id.message_l2);
            down1 = view.findViewById(R.id.message_down1);
            down2 = view.findViewById(R.id.message_down2);
            down1.setBackgroundColor(Color.parseColor("#f43a68"));
            l1.setOnClickListener(l);
            l2.setOnClickListener(l);
            return view;
        }
    
        View.OnClickListener l = new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                FragmentManager fm = getFragmentManager();
                FragmentTransaction ft = fm.beginTransaction();//开启事务
                Fragment f = null;
                switch (view.getId()) {
                    case R.id.message_l1:
                        f = new ConditionFragment();
                        ft.replace(R.id.fragment_dy_condition, f);
                        ft.commit();
                        down1.setBackgroundColor(Color.parseColor("#f43a68"));
                        down2.setBackgroundColor(Color.parseColor("#f4f4f4"));
                        break;
                    case R.id.message_l2:
                        f = new InfoFragment();
                        ft.replace(R.id.fragment_dy_condition, f);
                        ft.commit();
                        down1.setBackgroundColor(Color.parseColor("#f4f4f4"));
                        down2.setBackgroundColor(Color.parseColor("#f43a68"));
                        break;
                }
            }
        };
    }

    截图:

  • 相关阅读:
    使用tornado的gen模块改善程序性能
    分析Linux内核中进程的调度(时间片轮转)-《Linux内核分析》Week2作业
    博客园配置MarsEdit客户端
    分析一个C语言程序生成的汇编代码-《Linux内核分析》Week1作业
    微信支付的开发流程
    探究加法操作的原子性
    mac下mysql数据库的配置
    从range和xrange的性能对比到yield关键字(中)
    使用装饰器时带括号与不带括号的区别
    从range和xrange的性能对比到yield关键字(上)
  • 原文地址:https://www.cnblogs.com/xueqiuxiang/p/12740703.html
Copyright © 2011-2022 走看看