Android开发DataBinding使用的模版

【Android开发DataBinding使用的模版】感谢张鸿洋
打开设置,找到相应目录 Android开发DataBinding使用的模版
文章图片
屏幕快照 2016-06-14 上午9.41.21.png Android开发DataBinding使用的模版
文章图片
屏幕快照 2016-06-14 上午9.45.56.png 设置MyActivity

import android.os.Bundle; import android.support.annotation.Nullable; /** * Created by zhanghongqiang on ${DATE}${TIME} * ToDo: * */ public class ${NAME} extends BaseActivity{private ABCBinding mBinding; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); mBinding=DataBindingUtil.setContentView( this, R.layout.activity_a_b_c); } }

设置MyFragment
import android.support.annotation.NonNull; import android.support.annotation.Nullable; /** * Created by zhanghongqiang on ${DATE}${TIME} * ToDo: * */ public class ${NAME} extendsBaseFragment{private FragmentABCBinding mBinding; public static ${NAME} newInstance(int status) { ${NAME} fragment = new ${NAME}(); Bundle arguments = fragment.getArguments(); arguments.putSerializable(SiBuConstants.EXTRA_KEY_ORDER_TYPE, status); return fragment; }@Override public void onAttach(Context context) { super.onAttach(context); status =getArguments().getInt(SiBuConstants.EXTRA_KEY_ORDER_TYPE, -1); }@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroupcontainer, @Nullable BundlesavedInstanceState) { mBinding = DataBindingUtil.inflate(inflater,R.layout.fragment_a_b_c, container, false); return mBinding.getRoot(); }}

设置other里的 Android开发DataBinding使用的模版
文章图片
屏幕快照 2016-06-14 上午9.52.27.png
<${ROOT_TAG} android:layout_width="${LAYOUT_WIDTH}" android:layout_height="${LAYOUT_HEIGHT}" android:orientation="vertical">

    推荐阅读