Example usage for android.view LayoutInflater inflate

List of usage examples for android.view LayoutInflater inflate

Introduction

In this page you can find the example usage for android.view LayoutInflater inflate.

Prototype

public View inflate(XmlPullParser parser, @Nullable ViewGroup root, boolean attachToRoot) 

Source Link

Document

Inflate a new view hierarchy from the specified XML node.

Usage

From source file:com.example.cuisoap.agrimac.machineRegister.driverInfoFragment.java

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_driverinfo, container, false);
    drive_type1 = (RadioButton) view.findViewById(R.id.machine_drivetype_1);
    drive_type2 = (RadioButton) view.findViewById(R.id.machine_drivetype_2);
    driver_male = (RadioButton) view.findViewById(R.id.driver_male);
    driver_female = (RadioButton) view.findViewById(R.id.driver_female);
    driver_info = (LinearLayout) view.findViewById(R.id.machine_driverinfo);
    driver_name = (EditText) view.findViewById(R.id.driver_name);
    driver_age = (EditText) view.findViewById(R.id.driver_age);
    license = (Button) view.findViewById(R.id.driver_licence_button);
    license_pic = (ImageView) view.findViewById(R.id.driver_licence_pic);
    license_type = (TextView) view.findViewById(R.id.licence_type);
    drive_type = (RadioGroup) view.findViewById(R.id.drive_type);
    driver_gender = (RadioGroup) view.findViewById(R.id.driver_gender);
    confrim = (Button) view.findViewById(R.id.driver_confirm);
    drive_type2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override/*from w w w  .j a  v  a 2  s.  c om*/
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked)
                driver_info.setVisibility(View.GONE);
            else
                driver_info.setVisibility(View.VISIBLE);
        }
    });
    license.setOnClickListener(myOnClickListener);
    license_type.setOnClickListener(myOnClickListener);
    confrim.setOnClickListener(myOnClickListener);
    return view;
}

From source file:com.sakisds.icymonitor.fragments.history.HistoryPickerFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View mRootView = inflater.inflate(R.layout.fragment_list, container, false);
    mSettings = getActivity().getSharedPreferences(MainViewActivity.SHAREDPREFS_FILE, Context.MODE_PRIVATE);
    setHasOptionsMenu(true);/*  w w  w .  j a  v a  2s.  com*/
    return mRootView;
}

From source file:kr.co.generic.wifianalyzer.wifi.AccessPointDetail.java

View makeView(View convertView, ViewGroup parent, @NonNull WiFiDetail wiFiDetail, boolean isChild) {
    MainActivity mainActivity = MainContext.INSTANCE.getMainActivity();

    View view = convertView;/* ww  w  .j  av  a 2s.  c o  m*/
    if (view == null) {
        LayoutInflater layoutInflater = mainActivity.getLayoutInflater();
        AccessPointView accessPointView = mainActivity.getCurrentAccessPointView();
        view = layoutInflater.inflate(accessPointView.getLayout(), parent, false);
    }

    setViewCompact(mainActivity, view, wiFiDetail, isChild);
    if (view.findViewById(kr.co.generic.wifianalyzer.R.id.capabilities) != null) {
        setViewExtra(mainActivity, view, wiFiDetail);
        setViewVendorShort(view, wiFiDetail.getWiFiAdditional());
    }

    return view;
}

From source file:com.mbientlab.metawear.app.SensorFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    fragContainer = container;
    setRetainInstance(true);
    return inflater.inflate(layoutId, container, false);
}

From source file:br.liveo.ndrawer.ui.fragment.MainFragment21.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // TODO Auto-generated method stub      
    rootView = inflater.inflate(R.layout.fragment_main21, container, false);

    rootView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
    return rootView;
}

From source file:fr.enst.igr201.kanmogne.iconvert.ConvertTabFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootview = inflater.inflate(R.layout.fragment_convert_tab, container, false);
    return rootview;
}

From source file:com.miz.mizuu.fragments.ActorBrowserFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    return inflater.inflate(R.layout.image_grid_fragment, container, false);
}

From source file:com.github.chenxiaolong.dualbootpatcher.switcher.ZipFlashingOutputFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    return inflater.inflate(R.layout.fragment_zip_flashing_output, container, false);
}

From source file:experiment.com.example.anurag.hackinthenorth.RecyclerViewFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.recycler_view_frag, container, false);
    rootView.setTag(TAG);/*from  w  w  w  .j a  va2  s. co m*/

    // BEGIN_INCLUDE(initializeRecyclerView)
    mRecyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerView);

    // LinearLayoutManager is used here, this will layout the elements in a similar fashion
    // to the way ListView would layout elements. The RecyclerView.LayoutManager defines how
    // elements are laid out.
    mLayoutManager = new LinearLayoutManager(getActivity());

    mCurrentLayoutManagerType = LayoutManagerType.LINEAR_LAYOUT_MANAGER;

    if (savedInstanceState != null) {
        // Restore saved layout manager type.
        mCurrentLayoutManagerType = (LayoutManagerType) savedInstanceState.getSerializable(KEY_LAYOUT_MANAGER);
    }
    setRecyclerViewLayoutManager(mCurrentLayoutManagerType);

    mAdapter = new CustomAdapter(personList);
    // Set CustomAdapter as the adapter for RecyclerView.
    mRecyclerView.setAdapter(mAdapter);
    // END_INCLUDE(initializeRecyclerView)

    return rootView;
}

From source file:com.dnielfe.manager.adapters.BrowserListAdapter.java

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    final ViewHolder mViewHolder;
    int num_items = 0;
    final File file = new File(getItem(position));
    DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, Locale.getDefault());

    if (convertView == null) {
        LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = inflater.inflate(R.layout.item_browserlist, parent, false);
        mViewHolder = new ViewHolder(convertView);
        convertView.setTag(mViewHolder);
    } else {/* w ww.  ja v  a2  s.  c o  m*/
        mViewHolder = (ViewHolder) convertView.getTag();
    }

    if (Settings.mListAppearance > 0) {
        mViewHolder.dateview.setVisibility(TextView.VISIBLE);
    } else {
        mViewHolder.dateview.setVisibility(TextView.GONE);
    }

    if (Settings.showthumbnail)
        setIcon(file, mViewHolder.icon);
    else
        loadFromRes(file, mViewHolder.icon);

    if (file.isFile()) {
        // Shows the size of File
        mViewHolder.bottomView.setText(FileUtils.byteCountToDisplaySize(file.length()));
    } else {
        String[] list = file.list();

        if (list != null)
            num_items = list.length;

        // show the number of files in Folder
        mViewHolder.bottomView.setText(num_items + mResources.getString(R.string.files));
    }

    mViewHolder.topView.setText(file.getName());
    mViewHolder.dateview.setText(df.format(file.lastModified()));

    return convertView;
}