当前位置: 首页>>代码示例>>Java>>正文


Java FlexboxLayout.addView方法代码示例

本文整理汇总了Java中com.google.android.flexbox.FlexboxLayout.addView方法的典型用法代码示例。如果您正苦于以下问题:Java FlexboxLayout.addView方法的具体用法?Java FlexboxLayout.addView怎么用?Java FlexboxLayout.addView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.flexbox.FlexboxLayout的用法示例。


在下文中一共展示了FlexboxLayout.addView方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addItemTrainCategories

import com.google.android.flexbox.FlexboxLayout; //导入方法依赖的package包/类
public ItemBuilder addItemTrainCategories(Context context) {
    view = inflater.inflate(R.layout.item_element_categories_checkboxes, parent, false);
    TextView      tv            = (TextView) view.findViewById(R.id.tv_title);
    TextView      tv2           = (TextView) view.findViewById(R.id.tv_subtitle);
    FlexboxLayout fblCategories = (FlexboxLayout) view.findViewById(R.id.fbl_categories);
    tv.setText("Categorie di treni incluse nella ricerca");
    tv2.setText(SettingsPreferences.getCategoriesAsString(context, " / "));
    for (ENUM_CATEGORIES cat : ENUM_CATEGORIES.values()) {
        CheckBox                   cbCat  = new CheckBox(context);
        FlexboxLayout.LayoutParams params = new FlexboxLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        params.flexBasisPercent = 0.5f;
        cbCat.setLayoutParams(params);
        cbCat.setText(cat.getAlias());
        cbCat.setChecked(SettingsPreferences.isCategoryEnabled(context, cat));
        cbCat.setOnCheckedChangeListener((buttonView, isChecked) -> {
            if (isChecked || (!isChecked && SettingsPreferences.isPossibleToDisableCheckbox(context))) {
                SettingsPreferences.setCategory(context, cat.name(), isChecked);
                tv2.setText(SettingsPreferences.getCategoriesAsString(context, " / "));
            } else {
                cbCat.setChecked(true);
            }
        });
        fblCategories.addView(cbCat);
    }
    return this;
}
 
开发者ID:albertogiunta,项目名称:justintrain-client-android,代码行数:27,代码来源:ItemBuilder.java

示例2: onCreateView

import com.google.android.flexbox.FlexboxLayout; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Check if we've retained the Fragment or are creating it for the first time.
    if (retainedLayout == null) {
        // When creating for the first time we need to add the default tags for the default image.
        LinearLayout resultView = (LinearLayout)inflater.inflate(R.layout.recognition_result_view, container, false);
        FlexboxLayout imageTagContainer = (FlexboxLayout)inflater.inflate(R.layout.tag_box, null, false);
        imageTagContainer.addView(RecognitionResultBuilder.constructImageTag(inflater, "Blue Sky", "85%"));
        imageTagContainer.addView((RecognitionResultBuilder.constructImageTag(inflater, "Landscape", "60%")));
        resultView.addView(imageTagContainer);

        return resultView;
    } else {
        return retainedLayout;
    }
}
 
开发者ID:sebros,项目名称:vollDeinBier,代码行数:18,代码来源:RecognitionResultFragment.java

示例3: loadScheduleDescriptions

import com.google.android.flexbox.FlexboxLayout; //导入方法依赖的package包/类
private void loadScheduleDescriptions(FlexboxLayout descriptionContainer, int minutes) {
	int index = 0;
	for (ScheduleType scheduleType : schedules.get(minutes)) {
		View descriptionView = inflater.inflate(R.layout.item_schedule_description, descriptionContainer, false);
		// set up onclick listener
		LinearLayout scheduleLayout = descriptionView.findViewById(R.id.scheduleLayout);
		scheduleLayout.setOnClickListener(view -> {
			loadScheduleDetails(scheduleType);
		});
		// update textviews
		TextView monthsLabel = descriptionView.findViewById(R.id.bigLengthLabel);
		TextView weeksLabel = descriptionView.findViewById(R.id.smallLengthLabel);
		TextView repsLabel = descriptionView.findViewById(R.id.repsLabel);
		monthsLabel.setText(scheduleType.getCourseLength());
		weeksLabel.setText(scheduleType.getCourseLengthSmall());
		repsLabel.setText(scheduleType.getRepsAsString());
		// if it's the last one, don't show the "or"
		if (++index == schedules.get(minutes).size()) {
			TextView orLabel = descriptionView.findViewById(R.id.orLabel);
			orLabel.setVisibility(View.GONE);
		}
		// add view to container
		descriptionContainer.addView(descriptionView);
	}
}
 
开发者ID:chickendude,项目名称:GlossikaSchedule,代码行数:26,代码来源:NewScheduleScheduleFragment.java

示例4: createView

import com.google.android.flexbox.FlexboxLayout; //导入方法依赖的package包/类
@Override
public View createView(Context context, EventListFragment.OnLinkClickListener listener) {
    if (mPublicEventEntity == null) {
        return newTextView(context, "data empty", false, null);
    }
    FlexboxLayout flexboxLayout = newFlexboxLayout(context);
    TextView actionTextView = newTextView(context, "A private repository", true, null);
    flexboxLayout.addView(actionTextView);

    TextView userTextView = newTextView(context, getRepo().getFullName(), true,
            newOnLinkClickClickableSpan(listener, getRepo().getFullName(), getRepo().getHtmlUrl(), getRepo()));
    flexboxLayout.addView(userTextView);

    TextView toTextView = newTextView(context, "is open sourced", false, null);
    flexboxLayout.addView(toTextView);

    return flexboxLayout;
}
 
开发者ID:kwmt,项目名称:GitHubSearch,代码行数:19,代码来源:PublicEvent.java

示例5: createView

import com.google.android.flexbox.FlexboxLayout; //导入方法依赖的package包/类
@Override
public View createView(Context context, EventListFragment.OnLinkClickListener listener) {
    if(mPushEntity == null){
        return newTextView(context, "data empty", false, null);
    }

    FlexboxLayout flexboxLayout = newFlexboxLayout(context);
    TextView actionTextView = newTextView(context, "pushed", true, null);
    flexboxLayout.addView(actionTextView);

    GithubRepoEntity githubRepoEntity = new GithubRepoEntity(getRepo().getName());
    TextView pullRequestTextView = newTextView(context, githubRepoEntity.getFullName(), false, newOnLinkClickClickableSpan(listener, githubRepoEntity.getFullName(), githubRepoEntity.getHtmlUrl(),githubRepoEntity));
    flexboxLayout.addView(pullRequestTextView);

    return flexboxLayout;
}
 
开发者ID:kwmt,项目名称:GitHubSearch,代码行数:17,代码来源:PushEvent.java

示例6: createView

import com.google.android.flexbox.FlexboxLayout; //导入方法依赖的package包/类
@Override
public View createView(Context context, EventListFragment.OnLinkClickListener listener) {
    if (mMembershipEntity == null) {
        return newTextView(context, "data empty", false, null);
    }
    FlexboxLayout flexboxLayout = newFlexboxLayout(context);
    TextView actionTextView = newTextView(context, mMembershipEntity.getAction(), true, null);
    flexboxLayout.addView(actionTextView);

    TextView userTextView = newTextView(context, mMembershipEntity.getMember().getLogin(), true,
            newOnLinkClickClickableSpan(listener, mMembershipEntity.getMember().getLogin(), mMembershipEntity.getMember().getHtmlUrl(), getRepo()));
    flexboxLayout.addView(userTextView);

    TextView toTextView = newTextView(context, "to", true, null);
    flexboxLayout.addView(toTextView);

    TextView repoTextView = newTextView(context, getRepo().getName(), false,
            newOnLinkClickClickableSpan(listener, getRepo().getName(), getRepo().getHtmlUrl(), getRepo()));
    flexboxLayout.addView(repoTextView);

    return flexboxLayout;
}
 
开发者ID:kwmt,项目名称:GitHubSearch,代码行数:23,代码来源:MembershipEvent.java

示例7: createView

import com.google.android.flexbox.FlexboxLayout; //导入方法依赖的package包/类
@Override
public View createView(Context context, EventListFragment.OnLinkClickListener listener) {
    if (mMemberEventEntity == null) {
        return newTextView(context, "data empty", false, null);
    }
    FlexboxLayout flexboxLayout = newFlexboxLayout(context);
    TextView actionTextView = newTextView(context, mMemberEventEntity.getAction(), true, null);
    flexboxLayout.addView(actionTextView);

    TextView userTextView = newTextView(context, mMemberEventEntity.getUser().getLogin(), true,
            newOnLinkClickClickableSpan(listener, mMemberEventEntity.getUser().getLogin(), mMemberEventEntity.getUser().getHtmlUrl(), getRepo()));
    flexboxLayout.addView(userTextView);

    TextView toTextView = newTextView(context, "to", true, null);
    flexboxLayout.addView(toTextView);

    TextView repoTextView = newTextView(context, getRepo().getName(), false,
            newOnLinkClickClickableSpan(listener, getRepo().getName(), getRepo().getHtmlUrl(), getRepo()));
    flexboxLayout.addView(repoTextView);

    return flexboxLayout;
}
 
开发者ID:kwmt,项目名称:GitHubSearch,代码行数:23,代码来源:MemberEvent.java

示例8: createView

import com.google.android.flexbox.FlexboxLayout; //导入方法依赖的package包/类
@Override
public View createView(Context context, EventListFragment.OnLinkClickListener listener) {
    if(mPullRequestEventEntity == null){
        return newTextView(context, "data empty", false, null);
    }

    FlexboxLayout flexboxLayout = newFlexboxLayout(context);
    TextView actionTextView = newTextView(context, mPullRequestEventEntity.getAction()+ " pull request", true, null);
    flexboxLayout.addView(actionTextView);

    String pullRequest = getRepo().getName() + "#" + mPullRequestEventEntity.getNumber();
    TextView pullRequestTextView = newTextView(context, pullRequest, false, newOnLinkClickClickableSpan(listener, pullRequest, mPullRequestEventEntity.getPullRequestEntity().getHtmlUrl(), getRepo()));
    flexboxLayout.addView(pullRequestTextView);

    return flexboxLayout;
}
 
开发者ID:kwmt,项目名称:GitHubSearch,代码行数:17,代码来源:PullRequestEvent.java

示例9: initChildViews

import com.google.android.flexbox.FlexboxLayout; //导入方法依赖的package包/类
private void initChildViews() {
    final FlexboxLayout sourceLayout = (FlexboxLayout) findViewById(R.id.remaining_phrases);
    final FlexboxLayout targetLayout = (FlexboxLayout) findViewById(R.id.user_inputted_phrases);
    final FlexboxLayout.LayoutParams phraseParams = generateLayoutParams();

    sourceLayout.removeAllViews();
    targetLayout.removeAllViews();

    for (final String phrase : this.remainingInputBackupPhrase) {
        final DraggableShadowTextView userInputtedTextView = generateTargetTextView();
        final DraggableShadowTextView remainingTextView = generateSourceTextView(phrase);
        sourceLayout.addView(remainingTextView, phraseParams);
        targetLayout.addView(userInputtedTextView, phraseParams);
    }
    sourceLayout.requestLayout();
    targetLayout.requestLayout();
}
 
开发者ID:toshiapp,项目名称:toshi-android-client,代码行数:18,代码来源:DragAndDropView.java

示例10: onDataChild

import com.google.android.flexbox.FlexboxLayout; //导入方法依赖的package包/类
public void onDataChild(List<ReadChildTypeBean> datas) {
    View mHeaderView = inflate(getContext(), R.layout.recycler_header_read, null);
    FlexboxLayout flexboxLayout = findById(mHeaderView, R.id.flexboxLayout);
    if (flexboxLayout.getRootView() == null)
        return;
    flexboxLayout.removeAllViews();

    for (ReadChildTypeBean data : datas) {
        ImageView imageView = new ImageView(getContext());
        FlexboxLayout.LayoutParams layoutParams = new FlexboxLayout.LayoutParams(DensityUtils.dip2px(getContext(), 30), DensityUtils.dip2px(getContext(), 30));
        imageView.setLayoutParams(layoutParams);
        imageView.setOnClickListener(v -> ReadMoreActivity.start(getContext(),data.getUrl(),data.getTitle(),data.getImg()));
        flexboxLayout.addView(imageView);

        int size = DensityUtils.dip2px(getContext(), 10);
        FlexboxLayout.LayoutParams layoutParam = (FlexboxLayout.LayoutParams) imageView
                .getLayoutParams();
        layoutParam.setMargins(size, size, size, 0);
        imageView.setLayoutParams(layoutParam);
        GlideImageLoader.loadAdapterCircle(getContext(), data.getImg(), imageView);
    }
    RecyclerViewUtils.setHeaderView(recyclerView, mHeaderView);
}
 
开发者ID:dalingge,项目名称:GankGirl,代码行数:24,代码来源:ReadFragment.java

示例11: createView

import com.google.android.flexbox.FlexboxLayout; //导入方法依赖的package包/类
@Override
public View createView(Context context, EventListFragment.OnLinkClickListener listener) {
    if (mGistEntity == null) {
        return newTextView(context, "data empty", false, null);
    }
    FlexboxLayout flexboxLayout = newFlexboxLayout(context);

    for (int i = 0; i < mGistEntity.getPages().size(); i++) {
        PageEntity page = mGistEntity.getPages().get(i);
        TextView actionTextView = newTextView(context, page.getAction(), true, null);
        flexboxLayout.addView(actionTextView);

        // 最後はpaddingは不要
        boolean hasPadding = true;
        if (i == mGistEntity.getPages().size() - 1) {
            hasPadding = false;
        }
        TextView repoTextView = newTextView(context, page.getPageName(), hasPadding,
                newOnLinkClickClickableSpan(listener, page.getPageName(), page.getHtmlUrl(), getRepo()));
        flexboxLayout.addView(repoTextView);

        if (i < mGistEntity.getPages().size() - 1) {
            TextView andTextView = newTextView(context, "and", true, null);
            flexboxLayout.addView(andTextView);
        }
    }


    return flexboxLayout;
}
 
开发者ID:kwmt,项目名称:GitHubSearch,代码行数:31,代码来源:GollumEvent.java

示例12: createView

import com.google.android.flexbox.FlexboxLayout; //导入方法依赖的package包/类
@Override
public View createView(Context context, EventListFragment.OnLinkClickListener listener) {
    if (mDownloadEventEntity == null) {
        return newTextView(context, "data empty", false, null);
    }
    FlexboxLayout flexboxLayout = newFlexboxLayout(context);
    TextView actionTextView = newTextView(context, "downloaded ", true, null);
    flexboxLayout.addView(actionTextView);

    TextView repoTextView = newTextView(context, mDownloadEventEntity.getDownload().getName(), false,
            newOnLinkClickClickableSpan(listener, mDownloadEventEntity.getDownload().getName(), mDownloadEventEntity.getDownload().getHtmlUrl(), getRepo()));
    flexboxLayout.addView(repoTextView);
    return flexboxLayout;
}
 
开发者ID:kwmt,项目名称:GitHubSearch,代码行数:15,代码来源:DownloadEvent.java

示例13: createView

import com.google.android.flexbox.FlexboxLayout; //导入方法依赖的package包/类
@Override
public View createView(Context context, EventListFragment.OnLinkClickListener listener) {
    if(mCreateEntity == null){
        return newTextView(context, "data empty", false, null);
    }
    FlexboxLayout flexboxLayout = newFlexboxLayout(context);
    TextView actionTextView = newTextView(context, "created " + mCreateEntity.getRefType(), true, null);
    flexboxLayout.addView(actionTextView);

    TextView repoTextView = newTextView(context, getRepo().getName(), false, newOnLinkClickClickableSpan(listener, getRepo().getName(), getRepo().getHtmlUrl(), getRepo()));
    flexboxLayout.addView(repoTextView);
    return flexboxLayout;
}
 
开发者ID:kwmt,项目名称:GitHubSearch,代码行数:14,代码来源:CreateEvent.java

示例14: createView

import com.google.android.flexbox.FlexboxLayout; //导入方法依赖的package包/类
@Override
public View createView(Context context, EventListFragment.OnLinkClickListener listener) {
    if(mRepositoryEventEntity == null){
        return newTextView(context, "data empty", false, null);
    }

    FlexboxLayout flexboxLayout = newFlexboxLayout(context);
    TextView actionTextView = newTextView(context, mRepositoryEventEntity.getAction(), true, null);
    flexboxLayout.addView(actionTextView);

    TextView pullRequestTextView = newTextView(context, getRepo().getFullName(), false, newOnLinkClickClickableSpan(listener, getRepo().getFullName(), getRepo().getHtmlUrl(), getRepo()));
    flexboxLayout.addView(pullRequestTextView);

    return flexboxLayout;
}
 
开发者ID:kwmt,项目名称:GitHubSearch,代码行数:16,代码来源:RepositoryEvent.java

示例15: createView

import com.google.android.flexbox.FlexboxLayout; //导入方法依赖的package包/类
@Override
public View createView(Context context, EventListFragment.OnLinkClickListener listener) {
    if(mDeleteEntity == null){
        return newTextView(context, "data empty", false, null);
    }
    FlexboxLayout flexboxLayout = newFlexboxLayout(context);
    TextView actionTextView = newTextView(context, "deleted " + mDeleteEntity.getRefType(), true, null);
    flexboxLayout.addView(actionTextView);

    TextView repoTextView = newTextView(context, getRepo().getName(), false, newOnLinkClickClickableSpan(listener, getRepo().getName(), getRepo().getHtmlUrl(), getRepo()));
    flexboxLayout.addView(repoTextView);
    return flexboxLayout;
}
 
开发者ID:kwmt,项目名称:GitHubSearch,代码行数:14,代码来源:DeleteEvent.java


注:本文中的com.google.android.flexbox.FlexboxLayout.addView方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。