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


Java MsgView.setVisibility方法代码示例

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


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

示例1: hideMsg

import com.flyco.tablayout.widget.MsgView; //导入方法依赖的package包/类
public void hideMsg(int position) {
    if (position >= mTabCount) {
        position = mTabCount - 1;
    }

    View tabView = mTabsContainer.getChildAt(position);
    MsgView tipView = (MsgView) tabView.findViewById(R.id.rtv_msg_tip);
    if (tipView != null) {
        tipView.setVisibility(View.GONE);
    }
}
 
开发者ID:767954322,项目名称:FlycoTabLayout,代码行数:12,代码来源:SegmentTabLayout.java

示例2: show

import com.flyco.tablayout.widget.MsgView; //导入方法依赖的package包/类
public static void show(MsgView msgView, int num) {
    if (msgView == null) {
        return;
    }
    RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) msgView.getLayoutParams();
    DisplayMetrics dm = msgView.getResources().getDisplayMetrics();
    msgView.setVisibility(View.VISIBLE);
    if (num <= 0) {//圆点,设置默认宽高
        msgView.setStrokeWidth(0);
        msgView.setText("");

        lp.width = (int) (5 * dm.density);
        lp.height = (int) (5 * dm.density);
        msgView.setLayoutParams(lp);
    } else {
        lp.height = (int) (18 * dm.density);
        if (num > 0 && num < 10) {//圆
            lp.width = (int) (18 * dm.density);
            msgView.setText(num + "");
        } else if (num > 9 && num < 100) {//圆角矩形,圆角是高度的一半,设置默认padding
            lp.width = RelativeLayout.LayoutParams.WRAP_CONTENT;
            msgView.setPadding((int) (6 * dm.density), 0, (int) (6 * dm.density), 0);
            msgView.setText(num + "");
        } else {//数字超过两位,显示99+
            lp.width = RelativeLayout.LayoutParams.WRAP_CONTENT;
            msgView.setPadding((int) (6 * dm.density), 0, (int) (6 * dm.density), 0);
            msgView.setText("99+");
        }
        msgView.setLayoutParams(lp);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:32,代码来源:UnreadMsgUtils.java

示例3: hideMsg

import com.flyco.tablayout.widget.MsgView; //导入方法依赖的package包/类
/**
 * 隐藏未读消息
 */
public void hideMsg(int position) {
    if (position >= mTabCount) {
        position = mTabCount - 1;
    }

    View tabView = mTabsContainer.getChildAt(position);
    MsgView tipView = (MsgView) tabView.findViewById(R.id.rtv_msg_tip);
    if (tipView != null) {
        tipView.setVisibility(View.GONE);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:SlidingTabLayout.java

示例4: hideMsg

import com.flyco.tablayout.widget.MsgView; //导入方法依赖的package包/类
/** 隐藏未读消息 */
public void hideMsg(int position) {
    if (position >= mTabCount) {
        position = mTabCount - 1;
    }

    View tabView = mTabsContainer.getChildAt(position);
    MsgView tipView = (MsgView) tabView.findViewById(R.id.rtv_msg_tip);
    if (tipView != null) {
        tipView.setVisibility(View.GONE);
    }
}
 
开发者ID:767954322,项目名称:FlycoTabLayout,代码行数:13,代码来源:SlidingTabLayout.java

示例5: show

import com.flyco.tablayout.widget.MsgView; //导入方法依赖的package包/类
public static void show(MsgView msgView, int num) {
    if (msgView == null) {
        return;
    }
    RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) msgView.getLayoutParams();
    DisplayMetrics dm = msgView.getResources().getDisplayMetrics();
    if (num == 0) {
        msgView.setVisibility(View.GONE);
    } else if (num < 0) {//圆点,设置默认宽高
        msgView.setVisibility(View.VISIBLE);
        msgView.setStrokeWidth(0);
        msgView.setText("");

        lp.width = (int) (10 * dm.density);
        lp.height = (int) (10 * dm.density);
        msgView.setLayoutParams(lp);
    } else {
        msgView.setVisibility(View.VISIBLE);
        lp.height = (int) (18 * dm.density);
        if (num > 0 && num < 10) {//圆
            lp.width = (int) (18 * dm.density);
            msgView.setText(num + "");
        } else if (num > 9 && num < 100) {//圆角矩形,圆角是高度的一半,设置默认padding
            lp.width = RelativeLayout.LayoutParams.WRAP_CONTENT;
            msgView.setPadding((int) (6 * dm.density), 0, (int) (6 * dm.density), 0);
            msgView.setText(num + "");
        } else {//数字超过两位,显示99+
            lp.width = RelativeLayout.LayoutParams.WRAP_CONTENT;
            msgView.setPadding((int) (6 * dm.density), 0, (int) (6 * dm.density), 0);
            msgView.setText("99+");
        }
        msgView.setLayoutParams(lp);
    }
}
 
开发者ID:Blankeer,项目名称:MDWechat,代码行数:35,代码来源:UnreadMsgUtils.java


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