• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ViewUtil类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中de.mrapp.android.util.ViewUtil的典型用法代码示例。如果您正苦于以下问题:Java ViewUtil类的具体用法?Java ViewUtil怎么用?Java ViewUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ViewUtil类属于de.mrapp.android.util包,在下文中一共展示了ViewUtil类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: obtainBackground

import de.mrapp.android.util.ViewUtil; //导入依赖的package包/类
/**
 * Obtains the view's background from a specific typed array.
 *
 * @param typedArray
 *         The typed array, the background should be obtained from, as an instance of the class
 *         {@link TypedArray}. The typed array may not be null
 */
private void obtainBackground(@NonNull final TypedArray typedArray) {
    Drawable background = typedArray.getDrawable(R.styleable.TabSwitcher_android_background);

    if (background == null) {
        try {
            background = themeHelper.getDrawable(getLayout(), R.attr.tabSwitcherBackground);
        } catch (NotFoundException e) {
            background = null;
        }
    }

    if (background != null) {
        ViewUtil.setBackground(this, background);
    }
}
 
开发者ID:michael-rapp,项目名称:ChromeLikeTabSwitcher,代码行数:23,代码来源:TabSwitcher.java


示例2: onInflateTabView

import de.mrapp.android.util.ViewUtil; //导入依赖的package包/类
@NonNull
@Override
protected final View onInflateTabView(@NonNull final LayoutInflater inflater,
                                      @Nullable final ViewGroup parent,
                                      @NonNull final AbstractTabViewHolder viewHolder) {
    View view = inflater.inflate(R.layout.tablet_tab, parent, false);
    StateListDrawable backgroundDrawable = new StateListDrawable();
    Drawable defaultDrawable = ContextCompat
            .getDrawable(getModel().getContext(), R.drawable.tablet_tab_background);
    Drawable selectedDrawable = ContextCompat
            .getDrawable(getModel().getContext(), R.drawable.tablet_tab_background_selected);
    backgroundDrawable.addState(new int[]{android.R.attr.state_selected}, selectedDrawable);
    backgroundDrawable.addState(StateSet.WILD_CARD, defaultDrawable);
    ViewUtil.setBackground(view, backgroundDrawable);
    return view;
}
 
开发者ID:michael-rapp,项目名称:ChromeLikeTabSwitcher,代码行数:17,代码来源:TabletTabRecyclerAdapter.java


示例3: onInflateTabView

import de.mrapp.android.util.ViewUtil; //导入依赖的package包/类
@NonNull
@Override
protected final View onInflateTabView(@NonNull final LayoutInflater inflater,
                                      @Nullable final ViewGroup parent,
                                      @NonNull final AbstractTabViewHolder viewHolder) {
    View view = inflater.inflate(R.layout.phone_tab, parent, false);
    Drawable backgroundDrawable =
            ContextCompat.getDrawable(getModel().getContext(), R.drawable.phone_tab_background);
    ViewUtil.setBackground(view, backgroundDrawable);
    int padding = tabInset + tabBorderWidth;
    view.setPadding(padding, tabInset, padding, padding);
    ((PhoneTabViewHolder) viewHolder).contentContainer =
            view.findViewById(R.id.content_container);
    ((PhoneTabViewHolder) viewHolder).previewImageView =
            view.findViewById(R.id.preview_image_view);
    adaptPadding((PhoneTabViewHolder) viewHolder);
    ((PhoneTabViewHolder) viewHolder).borderView = view.findViewById(R.id.border_view);
    Drawable borderDrawable =
            ContextCompat.getDrawable(getModel().getContext(), R.drawable.phone_tab_border);
    ViewUtil.setBackground(((PhoneTabViewHolder) viewHolder).borderView, borderDrawable);
    return view;
}
 
开发者ID:michael-rapp,项目名称:ChromeLikeTabSwitcher,代码行数:23,代码来源:PhoneTabRecyclerAdapter.java


示例4: onInflateView

import de.mrapp.android.util.ViewUtil; //导入依赖的package包/类
@NonNull
@Override
protected final View onInflateView(@NonNull final LayoutInflater inflater,
                                   @Nullable final ViewGroup container,
                                   @Nullable final Bundle savedInstanceState) {
    frameLayout =
            (FrameLayout) inflater.inflate(R.layout.preference_fragment, container, false);
    buttonBarParent = frameLayout.findViewById(R.id.restore_defaults_button_bar_parent);
    buttonBarParent.setVisibility(showRestoreDefaultsButton ? View.VISIBLE : View.GONE);
    buttonBar = buttonBarParent.findViewById(R.id.restore_defaults_button_bar);
    ViewUtil.setBackground(buttonBar, buttonBarBackground);
    restoreDefaultsButton = buttonBarParent.findViewById(R.id.restore_defaults_button);
    restoreDefaultsButton.setOnClickListener(createRestoreDefaultsListener());
    restoreDefaultsButton.setText(restoreDefaultsButtonText);
    shadowView = buttonBarParent.findViewById(R.id.restore_defaults_button_bar_shadow_view);
    shadowView.setShadowElevation(buttonBarElevation);
    return frameLayout;
}
 
开发者ID:michael-rapp,项目名称:AndroidPreferenceActivity,代码行数:19,代码来源:PreferenceFragment.java


示例5: createScrollViewChildLayoutListener

import de.mrapp.android.util.ViewUtil; //导入依赖的package包/类
/**
 * Creates and returns a listener, which allows to observe, when the child of the dialog's
 * scroll view has been layouted. If the scroll view's height is greater than necessary, its
 * height is reduced to match the height of its child.
 *
 * @return The listener, which has been created, as an instance of the type {@link
 * OnGlobalLayoutListener}. The listener may not be null
 */
@NonNull
private OnGlobalLayoutListener createScrollViewChildLayoutListener() {
    return new OnGlobalLayoutListener() {

        @Override
        public void onGlobalLayout() {
            View child = scrollView.getChildAt(0);
            int childHeight = child.getHeight();
            int containerHeight = scrollView.getHeight() - scrollView.getPaddingTop() -
                    scrollView.getPaddingBottom();

            if (containerHeight > childHeight) {
                LinearLayout.LayoutParams layoutParams =
                        (LinearLayout.LayoutParams) scrollView.getLayoutParams();
                layoutParams.height = childHeight;
                layoutParams.weight = 0;
                scrollView.requestLayout();
            }

            ViewUtil.removeOnGlobalLayoutListener(child.getViewTreeObserver(), this);
        }

    };
}
 
开发者ID:michael-rapp,项目名称:AndroidMaterialDialog,代码行数:33,代码来源:DialogRootView.java


示例6: initialize

import de.mrapp.android.util.ViewUtil; //导入依赖的package包/类
/**
 * Initializes the view.
 */
private void initialize() {
    drawable = new TabSwitcherDrawable(getContext());
    setImageDrawable(drawable);
    ViewUtil.setBackground(this,
            ThemeUtil.getDrawable(getContext(), R.attr.selectableItemBackgroundBorderless));
    setContentDescription(null);
    setClickable(true);
    setFocusable(true);
}
 
开发者ID:michael-rapp,项目名称:ChromeLikeTabSwitcher,代码行数:13,代码来源:TabSwitcherButton.java


示例7: onGlobalLayout

import de.mrapp.android.util.ViewUtil; //导入依赖的package包/类
@Override
public void onGlobalLayout() {
    ViewUtil.removeOnGlobalLayoutListener(view.getViewTreeObserver(), this);

    if (listener != null) {
        listener.onGlobalLayout();
    }
}
 
开发者ID:michael-rapp,项目名称:ChromeLikeTabSwitcher,代码行数:9,代码来源:AbstractTabSwitcherLayout.java


示例8: onInflateView

import de.mrapp.android.util.ViewUtil; //导入依赖的package包/类
@NonNull
@Override
public final View onInflateView(@NonNull final LayoutInflater inflater,
                                @Nullable final ViewGroup parent,
                                @NonNull final TabItem tabItem, final int viewType,
                                @NonNull final Integer... params) {
    PhoneTabViewHolder viewHolder = new PhoneTabViewHolder();
    View view = inflater.inflate(R.layout.phone_tab, tabSwitcher.getTabContainer(), false);
    Drawable backgroundDrawable =
            ContextCompat.getDrawable(model.getContext(), R.drawable.phone_tab_background);
    ViewUtil.setBackground(view, backgroundDrawable);
    int padding = tabInset + tabBorderWidth;
    view.setPadding(padding, tabInset, padding, padding);
    viewHolder.titleContainer = (ViewGroup) view.findViewById(R.id.tab_title_container);
    viewHolder.titleTextView = (TextView) view.findViewById(R.id.tab_title_text_view);
    viewHolder.closeButton = (ImageButton) view.findViewById(R.id.close_tab_button);
    viewHolder.childContainer = (ViewGroup) view.findViewById(R.id.child_container);
    viewHolder.previewImageView = (ImageView) view.findViewById(R.id.preview_image_view);
    adaptPadding(viewHolder);
    viewHolder.borderView = view.findViewById(R.id.border_view);
    Drawable borderDrawable =
            ContextCompat.getDrawable(model.getContext(), R.drawable.phone_tab_border);
    ViewUtil.setBackground(viewHolder.borderView, borderDrawable);
    view.setTag(R.id.tag_view_holder, viewHolder);
    tabItem.setView(view);
    tabItem.setViewHolder(viewHolder);
    view.setTag(R.id.tag_properties, tabItem.getTag());
    return view;
}
 
开发者ID:NeoTerm,项目名称:NeoTerm,代码行数:30,代码来源:PhoneRecyclerAdapter.java


示例9: adaptBreadCrumbBackgroundColor

import de.mrapp.android.util.ViewUtil; //导入依赖的package包/类
/**
 * Adapts the background color of the toolbar, which is used to show the bread crumb of the
 * currently selected navigation preferences, when using the split screen layout.
 */
private void adaptBreadCrumbBackgroundColor() {
    if (breadCrumbToolbar != null) {
        GradientDrawable background = (GradientDrawable) ContextCompat
                .getDrawable(this, R.drawable.breadcrumb_background);
        background.setColor(breadCrumbBackgroundColor);
        ViewUtil.setBackground(getBreadCrumbToolbar(), background);
    }
}
 
开发者ID:michael-rapp,项目名称:AndroidPreferenceActivity,代码行数:13,代码来源:PreferenceActivity.java


示例10: createScrollViewLayoutListener

import de.mrapp.android.util.ViewUtil; //导入依赖的package包/类
/**
 * Creates and returns a {@link OnGlobalLayoutListener}, which allows to adjust the initial
 * visibility of the dividers, when a view has been layouted.
 *
 * @param view
 *         The observed view as an instance of the class {@link View}. The view may not be null
 * @return The listener, which has been created, as an instance of the type {@link
 * OnGlobalLayoutListener}. The listener may not be null
 */
@NonNull
private OnGlobalLayoutListener createScrollViewLayoutListener(@NonNull final View view) {
    return new OnGlobalLayoutListener() {

        @Override
        public void onGlobalLayout() {
            ViewUtil.removeOnGlobalLayoutListener(view.getViewTreeObserver(), this);
            adaptDividerVisibilities();
        }

    };
}
 
开发者ID:michael-rapp,项目名称:AndroidMaterialDialog,代码行数:22,代码来源:DialogRootView.java


示例11: adaptImageButtonBackground

import de.mrapp.android.util.ViewUtil; //导入依赖的package包/类
/**
 * Adapts the background of the image button, which is used to show the floating image button's
 * background and icon, depending on the floating button's colors.
 */
@SuppressLint("NewApi")
private void adaptImageButtonBackground() {
    Drawable background = createStateListBackgroundDrawable();

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Drawable rippleDrawable = new RippleDrawable(
                new ColorStateList(new int[][]{{}}, new int[]{getPressedColor()}), background,
                null);
        ViewUtil.setBackground(imageButton, rippleDrawable);
    } else {
        ViewUtil.setBackground(imageButton, background);
    }
}
 
开发者ID:michael-rapp,项目名称:AndroidMaterialViews,代码行数:18,代码来源:FloatingActionButton.java


示例12: initialize

import de.mrapp.android.util.ViewUtil; //导入依赖的package包/类
/**
 * Initializes the view.
 *
 * @param attributeSet
 *         The attribute set, the view's attributes should be obtained from, as an instance of
 *         the type {@link AttributeSet} or null, if no attributes should be obtained
 */
private void initialize(@Nullable final AttributeSet attributeSet) {
    listeners = new LinkedHashSet<>();
    inflateLayout();
    Drawable background = ContextCompat.getDrawable(getContext(), R.drawable.chip_background);
    ViewUtil.setBackground(this, background);
    obtainStyledAttributes(attributeSet);
}
 
开发者ID:michael-rapp,项目名称:AndroidMaterialViews,代码行数:15,代码来源:Chip.java


示例13: setSidebarBackground

import de.mrapp.android.util.ViewUtil; //导入依赖的package包/类
/**
 * Sets the background of the sidebar view.
 *
 * @param background
 *         The background, which should be set, as an instance of the class {@link Drawable} or
 *         null, if the default background should be used
 */
public final void setSidebarBackground(@Nullable final Drawable background) {
    this.sidebarBackground = background;

    if (sidebarBackground == null) {
        if (location == Location.LEFT) {
            sidebarView.setBackgroundResource(R.drawable.sidebar_background_left_light);
        } else {
            sidebarView.setBackgroundResource(R.drawable.sidebar_background_right_light);
        }
    } else {
        ViewUtil.setBackground(sidebarView, sidebarBackground);
    }
}
 
开发者ID:michael-rapp,项目名称:AndroidSidebar,代码行数:21,代码来源:SidebarView.java


示例14: adaptBackground

import de.mrapp.android.util.ViewUtil; //导入依赖的package包/类
/**
 * Adapts the bottom sheet's background.
 */
private void adaptBackground() {
    if (rootView != null && background != null) {
        ViewUtil.setBackground(rootView, background);
    }
}
 
开发者ID:michael-rapp,项目名称:AndroidBottomSheet,代码行数:9,代码来源:BottomSheet.java


示例15: adaptButtonBarBackground

import de.mrapp.android.util.ViewUtil; //导入依赖的package包/类
/**
 * Adapts the background of the button bar.
 */
private void adaptButtonBarBackground() {
    if (buttonBar != null) {
        ViewUtil.setBackground(buttonBar, buttonBarBackground);
    }
}
 
开发者ID:michael-rapp,项目名称:AndroidPreferenceActivity,代码行数:9,代码来源:PreferenceFragment.java


示例16: adaptNavigationBackground

import de.mrapp.android.util.ViewUtil; //导入依赖的package包/类
/**
 * Adapts the background of the navigation.
 */
private void adaptNavigationBackground() {
    if (navigationFragmentContainer != null) {
        ViewUtil.setBackground(navigationFragmentContainer, navigationBackground);
    }
}
 
开发者ID:michael-rapp,项目名称:AndroidPreferenceActivity,代码行数:9,代码来源:PreferenceActivity.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DefaultErrorHandler类代码示例发布时间:2022-05-23
下一篇:
Java TableRow类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap