當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。