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


Java RelativeLayout.setTag方法代码示例

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


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

示例1: getView

import android.widget.RelativeLayout; //导入方法依赖的package包/类
@Override
public View getView(final int position, final View convertView, ViewGroup parentView) {
    final RelativeLayout songListLayout = (RelativeLayout) songListInflater.inflate(R.layout.list_item_song_fixed, parentView, false);
    if (position % 2 - 1 == 0) {
        songListLayout.setBackgroundResource(R.color.gray_2);
    } else {
        songListLayout.setBackgroundResource(R.color.gray_3);
    }

    // Get the parts of a song layout
    //ImageView songItemIcon = (ImageView) songListLayout.findViewById(R.id.song_icon);
    TextView songItemName = (TextView) songListLayout.findViewById(R.id.song_name);
    TextView songItemArtist = (TextView) songListLayout.findViewById(R.id.song_composer);

    // Set the parts equal to the corresponding song
    SongData songItem = songDataList.get(position);
    //songItemIcon.setImageDrawable(songItem.getSongCover());
    songItemName.setText(songItem.getSongName());
    songItemArtist.setText(songItem.getSongArtist());

    // Set position as tag
    songListLayout.setTag(position);
    return songListLayout;
}
 
开发者ID:Davarco,项目名称:Divertio,代码行数:25,代码来源:SongFixedAdapter.java

示例2: getView

import android.widget.RelativeLayout; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parentView) {

    // Get the parts
    menuItemLayout = (RelativeLayout) layoutInflater.inflate(R.layout.list_item_menu_drawer, parentView, false);
    ImageView imageView = (ImageView) menuItemLayout.findViewById(R.id.menu_icon);
    TextView textView = (TextView) menuItemLayout.findViewById(R.id.menu_title);

    // Set the parts equal to the corresponding part
    Drawable icon = activity.getResources().getDrawable(iconIdList[position]);
    String title = titleList[position];
    imageView.setImageDrawable(icon);
    textView.setText(title);

    // Set position as tag
    menuItemLayout.setTag(position);
    return menuItemLayout;
}
 
开发者ID:Davarco,项目名称:Divertio,代码行数:19,代码来源:MenuDrawerAdapter.java

示例3: onBindView

import android.widget.RelativeLayout; //导入方法依赖的package包/类
@Override
public void onBindView(@Nullable Bundle savedInstanceState, View rootView) {
    final int size = ITEMS.size();
    for (int i = 0; i < size; i++) {
        LayoutInflater.from(getContext()).inflate(R.layout.bottom_item_icon_text_layout, mBottomBar);
        final RelativeLayout item = (RelativeLayout) mBottomBar.getChildAt(i);
        //设置每个item的点击事件
        item.setTag(i);
        item.setOnClickListener(this);
        final IconTextView itemIcon = (IconTextView) item.getChildAt(0);
        final AppCompatTextView itemTitle = (AppCompatTextView) item.getChildAt(1);
        final BottomTabBean bean = TAB_BEANS.get(i);
        //初始化数据
        itemIcon.setText(bean.getICON());
        itemTitle.setText(bean.getTITLE());
        if (i == mIndexDelegate) {
            itemIcon.setTextColor(mClickedColor);
            itemTitle.setTextColor(mClickedColor);
        }
    }
    final ISupportFragment[] delegateArray = ITEM_DELEGATES.toArray(new ISupportFragment[size]);
    getSupportDelegate().loadMultipleRootFragment(R.id.bottom_bar_delegate_container, mIndexDelegate, delegateArray);

}
 
开发者ID:remerber,项目名称:FastEc,代码行数:25,代码来源:BaseBottomDelegate.java

示例4: setTrailContent

import android.widget.RelativeLayout; //导入方法依赖的package包/类
private void setTrailContent() {
    List<TrailItem> trails = postsItem.getTrail();
    if (trails != null && trails.size() > 0) {
        trailLayout.removeAllViews();
        createTrailView(trails.size());
        for (int i = 0; i < trails.size(); i++) {
            RelativeLayout layout = trailViewCache.get(i);
            SimpleDraweeView avatar = (SimpleDraweeView) layout.findViewById(R.id.trail_avatar);
            TextView name = (TextView) layout.findViewById(R.id.trail_name);
            TextView content = (TextView) layout.findViewById(R.id.trail_content);
            FrescoUtils.setTumblrAvatarUri(avatar, trails.get(i).getBlog().getName(), 128);
            name.setText(trails.get(i).getBlog().getName());
            content.setText(fromHtlmCompat(trails.get(i).getContent_raw()));
            layout.setTag(trails.get(i).getBlog().getName());
            trailLayout.addView(layout);
        }
        trailLayout.setVisibility(View.VISIBLE);
    } else {
        trailLayout.setVisibility(View.GONE);
    }
}
 
开发者ID:mingdroid,项目名称:tumbviewer,代码行数:22,代码来源:PhotoPostVH.java

示例5: updateSelect

import android.widget.RelativeLayout; //导入方法依赖的package包/类
private void updateSelect() {
    this.viewImages.removeAllViews();
    if (this.mPathList.size() > 0) {
        Iterator it = this.mPathList.iterator();
        while (it.hasNext()) {
            String path = (String) it.next();
            RelativeLayout view = (RelativeLayout) LayoutInflater.from(getActivity()).inflate
                    (R.layout.me, null);
            ImageView view_delete_image = (ImageView) view.findViewById(R.id.view_delete_image);
            ImageView view_image = (ImageView) view.findViewById(R.id.view_image);
            view_delete_image.setTag(path);
            view_image.setTag(path);
            view_delete_image.setOnClickListener(this.mDeleteClick);
            view.setTag(path);
            this.imageLoader.displayImage("file://" + path, view_image, ImageLoaderOptions
                    .avatar());
            float dimen = getResources().getDimension(R.dimen.ba);
            this.viewImages.addView(view, new LayoutParams((int) dimen, (int) dimen));
            this.viewImages.invalidate();
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:23,代码来源:FragmentApn.java

示例6: createImageLayout

import android.widget.RelativeLayout; //导入方法依赖的package包/类
/**
 * 生成图片View
 */
private RelativeLayout createImageLayout() {
    RelativeLayout layout = (RelativeLayout) inflater.inflate(R.layout.edit_image_view, null);
    layout.setTag(viewTagIndex++);
    View closeView = layout.findViewById(R.id.image_close);
    //closeView.setVisibility(GONE);
    closeView.setTag(layout.getTag());
    closeView.setOnClickListener(btnListener);
    return layout;
}
 
开发者ID:yangchong211,项目名称:YCCustomText,代码行数:13,代码来源:HyperTextEditor.java

示例7: instantiateItem

import android.widget.RelativeLayout; //导入方法依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, int position) {
	if (bound == null || bound.getBridges().size() <= position) {
		Log.w(TAG, "Activity not bound when creating TerminalView.");
	}
	TerminalBridge bridge = bound.getBridges().get(position);
	bridge.promptHelper.setHandler(promptHandler);

	// inflate each terminal view
	RelativeLayout view = (RelativeLayout) inflater.inflate(
			R.layout.item_terminal, container, false);

	// set the terminal name overlay text
	TextView terminalNameOverlay = (TextView) view.findViewById(R.id.terminal_name_overlay);
	terminalNameOverlay.setText(bridge.host.getNickname());

	// and add our terminal view control, using index to place behind overlay
	final TerminalView terminal = new TerminalView(container.getContext(), bridge, pager);
	terminal.setId(R.id.terminal_view);
	view.addView(terminal, 0);

	// Tag the view with its bridge so it can be retrieved later.
	view.setTag(bridge);

	container.addView(view);
	terminalNameOverlay.startAnimation(fade_out_delayed);
	return view;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:29,代码来源:ConsoleActivity.java

示例8: getView

import android.widget.RelativeLayout; //导入方法依赖的package包/类
@Override
public View getView(final int position, final View convertView, ViewGroup parentView) {
    final RelativeLayout songListLayout = (RelativeLayout) songListInflater.inflate(R.layout.list_item_song, parentView, false);
    if (position % 2 - 1 == 0) {
        songListLayout.setBackgroundResource(R.color.gray_2);
    } else {
        songListLayout.setBackgroundResource(R.color.gray_3);
    }

    // Get the parts of a song layout
    //ImageView songItemIcon = (ImageView) songListLayout.findViewById(R.id.song_icon);
    ImageView songOverflowIcon = (ImageView) songListLayout.findViewById(R.id.song_overflow);
    TextView songItemName = (TextView) songListLayout.findViewById(R.id.song_name);
    TextView songItemArtist = (TextView) songListLayout.findViewById(R.id.song_composer);

    // Set the parts equal to the corresponding song
    SongData songItem = songDataList.get(position);
    //songItemIcon.setImageDrawable(songItem.getSongCover());
    songItemName.setText(songItem.getSongName());
    songItemArtist.setText(songItem.getSongArtist());

    // Set on click listener for overflow
    songOverflowIcon.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ((MainActivity) activity).showChoiceMenu(songListLayout, position);
        }
    });

    // Set position as tag
    songListLayout.setTag(position);
    return songListLayout;
}
 
开发者ID:Davarco,项目名称:Divertio,代码行数:34,代码来源:SongAdapter.java

示例9: getView

import android.widget.RelativeLayout; //导入方法依赖的package包/类
@Override
public View getView(final int position, View convertView, ViewGroup parentView) {
    final RelativeLayout playlistLayout = (RelativeLayout) playlistInflater.inflate(R.layout.list_item_playlist, parentView, false);
    if (position % 2 - 1 == 0) {
        playlistLayout.setBackgroundResource(R.color.gray_2);
    } else {
        playlistLayout.setBackgroundResource(R.color.gray_3);
    }

    // Get the parts of a playlist layout
    //ImageView playlistItemIcon = (ImageView) playlistLayout.findViewById(R.id.playlist_icon);
    ImageView playlistOverflowIcon = (ImageView) playlistLayout.findViewById(R.id.playlist_overflow);
    TextView playlistItemName = (TextView) playlistLayout.findViewById(R.id.playlist_name);
    TextView playlistItemSize = (TextView) playlistLayout.findViewById(R.id.playlist_size);

    // Set the parts equal to the corresponding playlist
    PlaylistData playlistItem = playlistDataList.get(position);
    //playlistItemIcon.setImageDrawable(playlistItem.getPlaylistIcon());
    playlistItemName.setText(playlistItem.getPlaylistName());
    if (playlistItem.getNumSongs() != 1) {
        playlistItemSize.setText(Integer.toString(playlistItem.getNumSongs()) + " songs");
    } else {
        playlistItemSize.setText(Integer.toString(playlistItem.getNumSongs()) + " song");
    }

    // Set on click listener for overflow
    playlistOverflowIcon.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ((PlaylistMenuActivity) activity).showChoiceMenu(playlistLayout, position);
        }
    });

    // Set position as tag
    playlistLayout.setTag(position);
    return playlistLayout;
}
 
开发者ID:Davarco,项目名称:Divertio,代码行数:38,代码来源:PlaylistAdapter.java

示例10: getView

import android.widget.RelativeLayout; //导入方法依赖的package包/类
@Override
public View getView(final int position, final View convertView, ViewGroup parentView) {
    relativeLayout = (RelativeLayout) layoutInflater.inflate(R.layout.list_item_album, parentView, false);
    if (position % 2 - 1 == 0) {
        relativeLayout.setBackgroundResource(R.color.gray_2);
    } else {
        relativeLayout.setBackgroundResource(R.color.gray_3);
    }

    // Get parts of layout
    ImageView albumCover = (ImageView) relativeLayout.findViewById(R.id.album_cover);
    TextView albumName = (TextView) relativeLayout.findViewById(R.id.album_name);
    TextView albumSize = (TextView) relativeLayout.findViewById(R.id.album_size);

    // Get values
    String name = keyList.get(position);
    Drawable cover = songAlbumList.get(name).get(0).getSongCover();
    RoundedBitmapDrawable drawable = RoundedBitmapDrawableFactory.create(activity.getResources(), ((BitmapDrawable) cover).getBitmap());
    drawable.setCornerRadius(50.0f);
    int size = songAlbumList.get(name).size();

    // Set values
    albumCover.setImageDrawable(drawable);
    albumName.setText(name);
    if (size == 1) {
        albumSize.setText("1 song");
    } else {
        albumSize.setText(Integer.toString(size) + " songs");
    }

    // Return
    relativeLayout.setTag(position);
    return relativeLayout;
}
 
开发者ID:Davarco,项目名称:Divertio,代码行数:35,代码来源:AlbumAdapter.java

示例11: getView

import android.widget.RelativeLayout; //导入方法依赖的package包/类
@Override
public View getView(final int position, final View convertView, ViewGroup parentView) {
    relativeLayout = (RelativeLayout) layoutInflater.inflate(R.layout.list_item_artist, parentView, false);
    if (position % 2 - 1 == 0) {
        relativeLayout.setBackgroundResource(R.color.gray_2);
    } else {
        relativeLayout.setBackgroundResource(R.color.gray_3);
    }

    // Get parts of layout
    TextView artistName = (TextView) relativeLayout.findViewById(R.id.artist_name);
    TextView artistSize = (TextView) relativeLayout.findViewById(R.id.artist_size);

    // Get values
    String name = keyList.get(position);
    int size = songArtistList.get(name).size();

    // Set values
    artistName.setText(name);
    if (size == 1) {
        artistSize.setText("1 song");
    } else {
        artistSize.setText(Integer.toString(size) + " songs");
    }

    // Return
    relativeLayout.setTag(position);
    return relativeLayout;
}
 
开发者ID:Davarco,项目名称:Divertio,代码行数:30,代码来源:ArtistAdapter.java

示例12: getView

import android.widget.RelativeLayout; //导入方法依赖的package包/类
@Override
public View getView(final int position, final View convertView, ViewGroup parentView) {
    relativeLayout = (RelativeLayout) layoutInflater.inflate(R.layout.list_item_genre, parentView, false);
    if (position % 2 - 1 == 0) {
        relativeLayout.setBackgroundResource(R.color.gray_2);
    } else {
        relativeLayout.setBackgroundResource(R.color.gray_3);
    }

    // Get parts of layout
    TextView genreName = (TextView) relativeLayout.findViewById(R.id.genre_name);
    TextView genreSize = (TextView) relativeLayout.findViewById(R.id.genre_size);

    // Get values
    String name = keyList.get(position);
    int size = songGenreList.get(name).size();

    // Set values
    genreName.setText(name);
    if (size == 1) {
        genreSize.setText("1 song");
    } else {
        genreSize.setText(Integer.toString(size) + " songs");
    }

    // Return
    relativeLayout.setTag(position);
    return relativeLayout;
}
 
开发者ID:Davarco,项目名称:Divertio,代码行数:30,代码来源:GenreAdapter.java

示例13: createImageLayout

import android.widget.RelativeLayout; //导入方法依赖的package包/类
/**
 * 生成图片View
 */
private RelativeLayout createImageLayout() {
    RelativeLayout layout = (RelativeLayout) inflater.inflate(R.layout.edit_image_view, null);
    layout.setTag(viewTagIndex++);
    View closeView = layout.findViewById(R.id.image_close);
    closeView.setVisibility(GONE);
    return layout;
}
 
开发者ID:yangchong211,项目名称:YCCustomText,代码行数:11,代码来源:HyperTextView.java

示例14: createToastView

import android.widget.RelativeLayout; //导入方法依赖的package包/类
private static View createToastView(Context context) {
        RelativeLayout root = new RelativeLayout(context);
        root.setTag("root");
        if (isSupport()) {
            root.setBackgroundResource(context.getResources().getIdentifier("colorAccent", "color", context.getPackageName()));
        }
        //root.setBackgroundColor(Color.RED);
        WindowManager.LayoutParams rootParams = new WindowManager.LayoutParams(-1, -2);
        rootParams.gravity = Gravity.TOP;
        root.setLayoutParams(rootParams);

        LinearLayout layout = new LinearLayout(context);
        layout.setOrientation(LinearLayout.HORIZONTAL);
        if (isSupport()) {
            layout.setBackgroundResource(context.getResources().getIdentifier("colorAccent", "color", context.getPackageName()));
        }
//        layout.setBackgroundResource(android.R.color.holo_red_dark);
//        layout.setVerticalGravity(Gravity.VERTICAL_GRAVITY_MASK);
        final RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(-2, -2);
        params.addRule(RelativeLayout.CENTER_IN_PARENT);
        layout.setLayoutParams(params);
        layout.setMinimumHeight(getMinHeight(context));

        ImageView imageView = new ImageView(context);
        imageView.setTag("image");
        imageView.setVisibility(View.GONE);

        TextView textView = new TextView(context);
        textView.setTag("text");
        textView.setTextColor(Color.WHITE);

        final LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-2, -2);
        layoutParams.setMargins(getMinHeight(context, 10), 0, 0, 0);
        layoutParams.gravity = Gravity.CENTER_VERTICAL;

        layout.addView(imageView, layoutParams);
        layout.addView(textView, layoutParams);
        root.addView(layout);
        return root;
    }
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:41,代码来源:T.java


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