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