无Xcode安装git ,卸载xcode后报错

xcode太大卸载后发现git不能用了,或者机器没有xcode安装时需要xcode,其实不需要安装xcode。

  1. 在终端执行命令: xcode-select –install# 单独安装CommandLineTools,不需要Xcode
  2. 然后指定新的路径:#sudo xcode-select –switch /Library/Developer/CommandLineTools
  3. 运行 git –version 输出版本信息就说明配置成功。

navigation drawer activity切换fragment实现不重新初始化保持原有操作

1、首先新建android工程主题为navigation drawer activity


2、增加fragment的xml至少2个。

如:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:orientation="vertical" >

    

<EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="hello"/>

</LinearLayout>

3、增加Fragment的java类继承Fragment

package com.liupengfei.components;

import android.app.Fragment;

import android.os.Bundle;

import android.view.LayoutInflater;

import android.view.View;

import android.view.ViewGroup;

public class MainFragment extends Fragment {

public MainFragment() {

}

@Override

public View onCreateView(LayoutInflater inflater, ViewGroup container,

Bundle savedInstanceState) {

return inflater.inflate(R.layout.fragment_main, container, false);

}

}