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


Java ViewGroup.setBackground方法代码示例

本文整理汇总了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));

   }
 
开发者ID:MSay2,项目名称:Mire,代码行数:23,代码来源:MainActivity.java

示例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);
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:15,代码来源:NotificationMainView.java

示例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;
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:32,代码来源:ChatFragment.java


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