本文整理汇总了Java中android.view.ViewGroup.setBackground方法的典型用法代码示例。如果您正苦于以下问题:Java ViewGroup.setBackground方法的具体用法?Java ViewGroup.setBackground怎么用?Java ViewGroup.setBackground使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.ViewGroup
的用法示例。
在下文中一共展示了ViewGroup.setBackground方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addMenuItem
import android.view.ViewGroup; //导入方法依赖的package包/类
private void addMenuItem(ViewGroup menu, String text, int drawableResource, int splashColor, int menu_btn, int menuIndex)
{
ViewGroup item = (ViewGroup)LayoutInflater.from(this).inflate(R.layout.menu_item, menu, false);
((TextView)item.findViewById(R.id.item_text)).setText(text);
CircularSplashView ic = (CircularSplashView)item.findViewById(R.id.circle);
ic.setSplash(BitmapFactory.decodeResource(getResources(), drawableResource));
ic.setSplashColor(splashColor);
item.setOnClickListener(getMenuItemCLick(menuIndex, splashColor));
if (menuIndex == 0)
{
menu.addView(item, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
}
else if (menuIndex == 3)
{
menu.addView(item, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
}
else
menu.addView(item, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
item.setBackground(getResources().getDrawable(menu_btn, null));
}
示例2: onFinishInflate
import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mTextAndBackground = (ViewGroup) findViewById(R.id.text_and_background);
ColorDrawable colorBackground = (ColorDrawable) mTextAndBackground.getBackground();
mBackgroundColor = colorBackground.getColor();
RippleDrawable rippleBackground = new RippleDrawable(ColorStateList.valueOf(
ThemeUtils.getAttrColor(getContext(), android.R.attr.colorControlHighlight)),
colorBackground, null);
mTextAndBackground.setBackground(rippleBackground);
mTitleView = (TextView) mTextAndBackground.findViewById(R.id.title);
mTextView = (TextView) mTextAndBackground.findViewById(R.id.text);
}
示例3: onCreateView
import android.view.ViewGroup; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_chat, container, false);
root.setBackground(CurrentTheme.getChatBackground(getActivity()));
((AppCompatActivity) getActivity()).setSupportActionBar(root.findViewById(R.id.toolbar));
mEmptyText = root.findViewById(R.id.fragment_chat_empty_text);
mRecyclerView = root.findViewById(R.id.fragment_friend_dialog_list);
mRecyclerView.setLayoutManager(createLayoutManager());
mRecyclerView.getItemAnimator().setChangeDuration(0);
mRecyclerView.getItemAnimator().setAddDuration(0);
mRecyclerView.getItemAnimator().setMoveDuration(0);
mRecyclerView.getItemAnimator().setRemoveDuration(0);
mRecyclerView.addOnScrollListener(new PicassoPauseOnScrollListener(Constants.PICASSO_TAG));
mHeaderView = inflater.inflate(R.layout.footer_load_more, mRecyclerView, false);
mLoadMoreFooterHelper = LoadMoreFooterHelper.createFrom(mHeaderView, () -> getPresenter().fireLoadUpButtonClick());
mInputViewController = new InputViewController(getActivity(), root, true, this);
mInputViewController.setSendOnEnter(Settings.get()
.main()
.isSendByEnter());
mInputViewController.setRecordActionsCallback(this);
mInputViewController.setOnSickerClickListener(this);
return root;
}