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


Java TableLayout.setVisibility方法代码示例

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


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

示例1: initMatch

import android.widget.TableLayout; //导入方法依赖的package包/类
private void initMatch() {
    View root = getView();
    if (root != null) {
        initMap(root.findViewById(R.id.dota_map));
        TableLayout table = (TableLayout) root.findViewById(R.id.match_summary_table);
        table.setVisibility(View.VISIBLE);
        ((TextView) root.findViewById(R.id.match_id)).setText(String.valueOf(match.getId()));

        long timestamp = match.getStartTime();
        String localTime = sdf.format(new Date(timestamp * 1000));
        ((TextView) root.findViewById(R.id.start_time)).setText(localTime);

        long durationInSeconds = match.getDuration();
        long minutes = durationInSeconds / 60;
        long seconds = durationInSeconds - minutes * 60;
        ((TextView) root.findViewById(R.id.match_length))
                .setText(minutes + ":" + (seconds < 10 ? "0" : "") + seconds);

        String[] lobbyTypes = getResources().getStringArray(R.array.lobby_types);
        ((TextView) root.findViewById(R.id.lobby_type)).setText(
                match.getLobbyType() != -1 && match.getLobbyType() < lobbyTypes.length ? lobbyTypes[match
                        .getLobbyType()] : "Invalid");

        String[] gameModes = getResources().getStringArray(R.array.game_modes);
        ((TextView) root.findViewById(R.id.game_mode)).setText(match.getGame_mode() <= gameModes.length ? gameModes[Math.max(0, (int) match.getGame_mode() - 1)] : "Invalid");

        if (TextUtils.isEmpty(match.getRadiantName()) || TextUtils.isEmpty(match.getDireName())) {
            root.findViewById(R.id.team_names).setVisibility(View.GONE);
        } else {
            root.findViewById(R.id.team_names).setVisibility(View.VISIBLE);
            ((TextView) root.findViewById(R.id.radiant_name)).setText(match.getRadiantName());
            ((TextView) root.findViewById(R.id.dire_name)).setText(match.getDireName());
        }
        if (match.getPicks_bans() != null && match.getPicks_bans().size() > 0) {
            TableLayout cmModeTable = (TableLayout) root.findViewById(R.id.cm_mode_table);
            List<PickBan> pickBans = match.getPicks_bans();
            Activity activity = getActivity();
            if (activity != null) {
                LayoutInflater inflater = activity.getLayoutInflater();
                BeanContainer container = BeanContainer.getInstance();
                HeroService heroService = container.getHeroService();

                for (PickBan pickBan : pickBans) {
                    ViewGroup row = (ViewGroup) inflater.inflate(R.layout.pick_ban, cmModeTable, false);
                    ImageView currentImage;
                    if (pickBan.getTeam() == 0) {
                        currentImage = (ImageView) row.findViewById(R.id.radiant_hero);
                    } else {
                        currentImage = (ImageView) row.findViewById(R.id.dire_hero);
                    }
                    Hero hero = heroService.getHeroById(activity, pickBan.getHeroId());
                    if (hero != null) {
                        if (pickBan.isPick()) {
                            Glide.with(activity).load(SteamUtils.getHeroFullImage(hero.getDotaId())).into(currentImage);
                        } else {
                            Glide.with(activity).load(SteamUtils.getHeroFullImage(hero.getDotaId())).into(new GrayImageLoadListener(currentImage));
                        }
                        currentImage.setOnClickListener(new HeroInfoActivity.OnDotaHeroClickListener(hero.getId()));
                    }
                    cmModeTable.addView(row);
                }
            }
        }
    }
}
 
开发者ID:mrprona92,项目名称:SecretBrand,代码行数:66,代码来源:MatchSummary.java


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