當前位置: 首頁>>代碼示例>>Java>>正文


Java LayoutInflater類代碼示例

本文整理匯總了Java中android.view.LayoutInflater的典型用法代碼示例。如果您正苦於以下問題:Java LayoutInflater類的具體用法?Java LayoutInflater怎麽用?Java LayoutInflater使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


LayoutInflater類屬於android.view包,在下文中一共展示了LayoutInflater類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createView

import android.view.LayoutInflater; //導入依賴的package包/類
/**
 * create a view from resource Xml file, and hold the view that may be used in displaying data.
 *
 * @param layoutInflater
 */
@Override
public View createView(LayoutInflater layoutInflater) {
    View view = layoutInflater.inflate(R.layout.with_long_press_list_view_item, null);
    mImageView = (CubeImageView) view.findViewById(R.id.with_long_press_list_image);
    return view;
}
 
開發者ID:sathishmscict,項目名稱:android-Ultra-Pull-To-Refresh,代碼行數:12,代碼來源:WithLongPressFragment.java

示例2: onCreateView

import android.view.LayoutInflater; //導入依賴的package包/類
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {
  Bundle bundle = getArguments();
  accessToken = bundle.getString(PlaceConstants.ACCESS_TOKEN);
  placeOptions = bundle.getParcelable(PlaceConstants.PLACE_OPTIONS);
  if (placeOptions == null) {
    // Increase geocoding limit
    placeOptions = PlaceOptions.builder().limit(10).build();
  }

  mode = placeOptions.viewMode();
  rootView = inflater.inflate(
    mode == PlaceOptions.MODE_CARDS ? R.layout.fragment_autocomplete_card
      : R.layout.fragment_autocomplete_full,
    container, false);

  bindViews();
  bindClickListeners();
  return rootView;
}
 
開發者ID:mapbox,項目名稱:mapbox-plugins-android,代碼行數:23,代碼來源:PlaceAutocompleteFragment.java

示例3: getView

import android.view.LayoutInflater; //導入依賴的package包/類
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder viewHolder;
    if (convertView == null) {
        viewHolder = new ViewHolder();
        convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_item_share, parent, false);
        viewHolder.ivShareLogo = (ImageView) convertView.findViewById(R.id.share_item_logo);
        viewHolder.tvShareName = (TextView) convertView.findViewById(R.id.share_item_name);
        convertView.setTag(viewHolder);
    } else {
        viewHolder = (ViewHolder) convertView.getTag();
    }
    SharePlatform sharePlatform = getItem(position);
    if (sharePlatform != null) {
        viewHolder.ivShareLogo.setImageResource(sharePlatform.logoRes);
        viewHolder.tvShareName.setText(sharePlatform.name);
    }
    return convertView;
}
 
開發者ID:wuhighway,項目名稱:UShareDemo,代碼行數:20,代碼來源:ShareCustomPopupWindow.java

示例4: initialize

import android.view.LayoutInflater; //導入依賴的package包/類
private void initialize() {
    LayoutInflater.from(getContext()).inflate(R.layout.match_card_view, this);

    /*
     * Get view references
     */
    profileImageView = (ImageView) findViewById(R.id.match_card_view_profile_image);
    nameTextView = (TextView) findViewById(R.id.match_card_view_name_text);
    ageTextView = (TextView) findViewById(R.id.match_card_view_age_text);
    filterImageView = (ImageView) findViewById(R.id.match_card_view_filter_image);
    bioTextView = (TextView) findViewById(R.id.match_card_view_bio_text);
    scoreTextView = (TextView) findViewById(R.id.match_card_view_score_text);

    rejectButton = (Button) findViewById(R.id.match_card_view_reject_button);
    acceptButton = (Button) findViewById(R.id.match_card_view_accept_button);
    chatButton = (ImageButton) findViewById(R.id.match_card_view_chat_button);

    rejectButton.setOnClickListener(rejectClickListener);
    acceptButton.setOnClickListener(acceptClickListener);
    chatButton.setOnClickListener(chatClickListener);
}
 
開發者ID:KwalaGroup,項目名稱:Android-Client,代碼行數:22,代碼來源:MatchCardView.java

示例5: ConfirmDialog

import android.view.LayoutInflater; //導入依賴的package包/類
private ConfirmDialog(Context ctx) {
    mContext = ctx;
    internalDialogBuilder = new AlertDialog.Builder(mContext, R.style.ConfirmDialogStyle);
    layoutInflater = (LayoutInflater)ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
 
開發者ID:YuntaoWei,項目名稱:PictureShow,代碼行數:6,代碼來源:ConfirmDialog.java

示例6: onCreateView

import android.view.LayoutInflater; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View layout = inflater.inflate(R.layout.chat_fragment_group, container, false);

    listGroup = GroupDB.getInstance(getContext()).getListGroups();
    recyclerListGroups = (RecyclerView) layout.findViewById(R.id.recycleListGroup);
    mSwipeRefreshLayout = (SwipeRefreshLayout) layout.findViewById(R.id.swipeRefreshLayout);
    mSwipeRefreshLayout.setOnRefreshListener(this);
    GridLayoutManager layoutManager = new GridLayoutManager(getContext(), 2);
    recyclerListGroups.setLayoutManager(layoutManager);
    adapter = new ListMovieAdapter(getContext(), listGroup);
    recyclerListGroups.setAdapter(adapter);


    if(listGroup.size() == 0){
        //Ket noi server hien thi group
        mSwipeRefreshLayout.setRefreshing(true);
        getListGroup();
    }
    return layout;
}
 
開發者ID:ansarisufiyan777,項目名稱:Show_Chat,代碼行數:23,代碼來源:TVFragment.java

示例7: GyroView

import android.view.LayoutInflater; //導入依賴的package包/類
public GyroView(Context context) {
    super(context);
    this.context = context;

    setFitsSystemWindows(true);

    View v = LayoutInflater.from(getContext()).inflate(R.layout.text, this, false);
    addView(v);

    sensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
    sensor = sensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE);
    textX = (TextView) findViewById(R.id.TextX);
    textY = (TextView) findViewById(R.id.TextY);
    textZ = (TextView) findViewById(R.id.TextZ);
    sensorManager.registerListener(this, sensor, SensorManager.SENSOR_DELAY_NORMAL);

}
 
開發者ID:MJonesDev,項目名稱:GyroCheck-Android-Library,代碼行數:18,代碼來源:GyroView.java

示例8: builder

import android.view.LayoutInflater; //導入依賴的package包/類
public AlertDialogBuilder builder() {
    View view = LayoutInflater.from(this.context).inflate(R.layout.o5, null);
    this.txt_title = (TextView) view.findViewById(R.id.txt_title);
    this.txt_title.setVisibility(8);
    this.txt_msg = (TextView) view.findViewById(R.id.txt_msg);
    this.txt_msg.setVisibility(8);
    this.btn_neg = (Button) view.findViewById(R.id.btn_neg);
    this.btn_neg.setVisibility(8);
    this.btn_pos = (Button) view.findViewById(R.id.btn_pos);
    this.btn_pos.setVisibility(8);
    this.img_line = (ImageView) view.findViewById(R.id.img_line);
    this.img_line.setVisibility(8);
    this.dialog = new Dialog(this.context, R.style.d);
    this.dialog.setContentView(view);
    return this;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:17,代碼來源:AlertDialogBuilder.java

示例9: onCreateView

import android.view.LayoutInflater; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    View root = inflater.inflate(R.layout.fragment_team_issue_detail,
            container, false);
    Intent args = getActivity().getIntent();
    if (args != null) {
        mTeam = (Team) args.getSerializableExtra("team");
        mTeamIssue = (TeamIssue) args.getSerializableExtra("issue");
        mCatalog = (TeamIssueCatalog) args
                .getSerializableExtra("issue_catalog");
    }
    if (mCatalog != null) {

        ((BaseActivity) getActivity()).setActionBarTitle(mCatalog
                .getTitle());
    }
    initView(root);
    initData();
    return root;
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:23,代碼來源:TeamIssueDetailFragment.java

示例10: onCreateView

import android.view.LayoutInflater; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
						 Bundle savedInstanceState)
{
	View view = inflater.inflate(R.layout.fragment_profile, container, false);
	unbinder = ButterKnife.bind(this, view);

	exitButton.setOnClickListener(new View.OnClickListener() {
		@Override
		public void onClick(View v) {
			SharedPreferenceHelper.setToken("");

			Intent intent = new Intent(getContext(), RegisterActivity.class);
			intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
			startActivity(intent);
		}
	});

	onViewClicked();

	return view;
}
 
開發者ID:Svyatozar,項目名稱:Navalny.Pulse,代碼行數:23,代碼來源:ProfileFragment.java

示例11: init

import android.view.LayoutInflater; //導入依賴的package包/類
private void init() {
    container = new LinearLayout(getContext());
    container.setOrientation(LinearLayout.VERTICAL);
    container.setBackgroundResource(R.color.silver);
    for (GeneralCredit general : studentCredit.getGeneralCredits()) {
        LayoutInflater inflater = LayoutInflater.from(getContext());
        TextView title_text = (TextView) inflater.inflate(
                R.layout.credit_textview, this, false);
        title_text.setBackgroundResource(R.color.cloud);
        title_text.setTypeface(title_text.getTypeface(), Typeface.BOLD);
        title_text.setText(general.getTypeName());
        container.addView(title_text);
        TextView text = (TextView) inflater.inflate(
                R.layout.credit_textview, this, false);
        text.setBackgroundResource(R.color.white);
        String credit_text = getContext().getString(R.string.credit_essential_core) + general.getMustCoreCredit()
                + "  "+getContext().getString(R.string.credit_general_core) + general.getHadCoreCredit() + "  " + getContext().getString(R.string.credit_general_elective)
                + general.getHadCommonCredit();
        text.setText(credit_text);
        container.addView(text);
        addData(general);
    }
    addView(container);
}
 
開發者ID:kamisakihideyoshi,項目名稱:TaipeiTechRefined,代碼行數:25,代碼來源:CreditGeneralView.java

示例12: onCreateView

import android.view.LayoutInflater; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    //Init view model
    mViewModel = new AbsencesViewModel();
    // Inflate the layout for this fragment
    View v =  inflater.inflate(R.layout.fragment_attendance, container, false);
    ButterKnife.bind(this,v);

    rviAbsences.setLayoutManager(new LinearLayoutManager(getContext()));
    progressBar.setVisibility(View.VISIBLE);

    if(mAdapter==null){
        mAdapter = new AbsencesAdapter(getContext());
        mSubscription.add(mViewModel.getAttendanceStream()
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(this::addAbsence,this::displayError));
    }else{
        progressBar.setVisibility(View.GONE);
    }

    rviAbsences.setAdapter(mAdapter);

    return v;
}
 
開發者ID:Bruno125,項目名稱:Unofficial-Ups,代碼行數:26,代碼來源:AbsencesFragment.java

示例13: onCreateView

import android.view.LayoutInflater; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    view = inflater.inflate(R.layout.status_pedestrian_tab_view, container, false);

    trafficLightImageView = (ImageView) view.findViewById(R.id.tab1_trafficLight_ImageView);
    trafficLightImageView.setImageResource(R.drawable.red_light);

    // Create the Handler object (on the main thread by default)
    handler = new Handler();

    appData = AppData.getInstance();

    startPeriodicRequestFromRestService();

    return view;
}
 
開發者ID:shreaker,項目名稱:V2I-Traffic-Light-Demonstrator,代碼行數:19,代碼來源:StatusPedestrianTab.java

示例14: onCreateViewHolder

import android.view.LayoutInflater; //導入依賴的package包/類
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    switch (viewType) {
        case InfoItem.TYPE_SIMPLE_INFO:
            return new ViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_simpe_info, parent, false));
        case InfoItem.TYPE_CUSTOM_TITLE:
            return new ViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_custom_title, parent, false));
        case InfoItem.TYPE_DETAIL_INFO:
            return new ViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_detail_info, parent, false));
        case InfoItem.TYPE_PERSONAL_ACHIEVEMENT:
            return new ViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_personal_achievement, parent, false));
        case InfoItem.TYPE_SIMPLE_ITEM:
            return new ViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_simple_item, parent, false));
        case InfoItem.TYPE_QUESTION:
            return new ViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_question, parent, false));
    }
    return null;
}
 
開發者ID:Drizzlezhang,項目名稱:ZhihuUserProfile,代碼行數:19,代碼來源:UserInfoFragment.java

示例15: onCreateView

import android.view.LayoutInflater; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_post_view, container, false);
    mRecyclerView = (RecyclerView) rootView.findViewById(R.id.rv_post);
    mLayoutManager = new StaggeredGridLayoutManager(SPAN_COUNT, StaggeredGridLayoutManager.VERTICAL);
    mRecyclerView.setLayoutManager(mLayoutManager);
    mSwipeRefreshLayout = rootView.findViewById(R.id.scroll_view);
    mSwipeRefreshLayout.setColorSchemeResources(
            android.R.color.holo_blue_bright,
            android.R.color.holo_green_light,
            android.R.color.holo_orange_light,
            android.R.color.holo_red_light);
    mAdapter = new PostViewAdapter(mListener, "post");
    mRecyclerView.setAdapter(mAdapter);
    return rootView;
}
 
開發者ID:fiepi,項目名稱:moebooru-android,代碼行數:18,代碼來源:PostFragment.java


注:本文中的android.view.LayoutInflater類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。