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


Java LinearLayout.setTag方法代码示例

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


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

示例1: getView

import android.widget.LinearLayout; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if( convertView == null ){
        //We must create a View:
        convertView = songInf.inflate(R.layout.song, parent, false);
    }        //map to song layout
    LinearLayout songLay = (LinearLayout) convertView;
    //get title and artist views
    TextView songView = (TextView) songLay.findViewById(R.id.song_title);
    TextView artistView = (TextView) songLay.findViewById(R.id.song_artist);
    //get song using position
    Song currSong = songs.get(position);
    //get title and artist strings
    songView.setText(currSong.getTitle());
    artistView.setText(currSong.getArtist());
    //set position as tag
    songLay.setTag(position);
    return songLay;
}
 
开发者ID:n76,项目名称:Symphony,代码行数:20,代码来源:SongAdapter.java

示例2: init

import android.widget.LinearLayout; //导入方法依赖的package包/类
private void init(Context context) {
    mContainIndicatorAndFooterLayout = new RelativeLayout(getContext());
    mOriginContainIndicatorAndFooterLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    mContainIndicatorAndFooterLayout.setLayoutParams(mOriginContainIndicatorAndFooterLayoutParams);

    mIndicatorLayout = new LinearLayout(context);
    //用来标记子控件,以便重排子控件在父容器顺序
    mIndicatorLayout.setTag(BODY_LAYOUT_TAG);
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, mFilterBarHeight);
    mIndicatorLayout.setLayoutParams(layoutParams);
    mIndicatorLayout.setBackgroundColor(Color.WHITE);
    mIndicatorLayout.setGravity(Gravity.CENTER_VERTICAL);
    mIndicatorLayout.setOrientation(LinearLayout.HORIZONTAL);

    mContainIndicatorAndFooterLayout.addView(mIndicatorLayout);
    addView(mContainIndicatorAndFooterLayout);

    int size = mIndicatorUnitList.size();
    for (int i = 0; i < size; i++) {
        addIndicatorUnit(context, i);
        if (i < size - 1) {
            addFilterBarLine(context);
        }
    }
}
 
开发者ID:Sugarya,项目名称:Closet,代码行数:26,代码来源:FilterBarLayout.java

示例3: addCrumb

import android.widget.LinearLayout; //导入方法依赖的package包/类
public void addCrumb(@NonNull Crumb crumb, boolean refreshLayout) {
    LinearLayout view = (LinearLayout) LayoutInflater.from(getContext()).inflate(R.layout.bread_crumb, this, false);
    view.setTag(mCrumbs.size());
    view.setOnClickListener(this);

    ImageView iv = (ImageView) view.getChildAt(1);
    if (Build.VERSION.SDK_INT >= 19 && iv.getDrawable() != null) {
        iv.getDrawable().setAutoMirrored(true);
    }
    iv.setVisibility(View.GONE);

    mChildFrame.addView(view, new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    mCrumbs.add(crumb);
    if (refreshLayout) {
        mActive = mCrumbs.size() - 1;
        requestLayout();
    }
    invalidateActivatedAll();
}
 
开发者ID:aliumujib,项目名称:Orin,代码行数:21,代码来源:BreadCrumbLayout.java

示例4: addCrumb

import android.widget.LinearLayout; //导入方法依赖的package包/类
public void addCrumb(@NonNull Crumb crumb, boolean refreshLayout) {
    LinearLayout view = (LinearLayout) LayoutInflater.from(getContext()).inflate(R.layout.layout_bread_crumb, this, false);
    view.setTag(mCrumbs.size());
    view.setOnClickListener(this);

    ImageView iv = (ImageView) view.getChildAt(1);
    Drawable arrow = getResources().getDrawable(R.mipmap.ic_right_arrow);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        if (arrow != null) {
            arrow.setAutoMirrored(true);
        }
    }
    iv.setImageDrawable(arrow);
    iv.setVisibility(View.GONE);

    mChildFrame.addView(view, new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    mCrumbs.add(crumb);
    if (refreshLayout) {
        mActive = mCrumbs.size() - 1;
        requestLayout();
    }
    invalidateActivatedAll();
}
 
开发者ID:Jusenr,项目名称:androidgithub,代码行数:25,代码来源:LinearBreadcrumbView.java

示例5: onRestoreInstanceState

import android.widget.LinearLayout; //导入方法依赖的package包/类
@Override
public void onRestoreInstanceState(Bundle state) {
    boolean[] weekstate = state.getBooleanArray(STATE_WEEK);
    for (int i = 0; i < weekstate.length; i++) {
        LinearLayout day = getDayLayout(i);
        day.setTag(weekstate[i]);
    }

    if (singleSelected) {
        disableDays();
    } else {
        enableDays();
    }

    super.onRestoreInstanceState(state);
}
 
开发者ID:jcolladosp,项目名称:ePills,代码行数:17,代码来源:AddPillSetTime.java

示例6: addItem

import android.widget.LinearLayout; //导入方法依赖的package包/类
private void addItem(SwipeMenuItem item, int index) {
    LayoutParams params = new LayoutParams(item.getWidth(), item.getHeight());
    params.weight = item.getWeight();
    LinearLayout parent = new LinearLayout(getContext());
    parent.setId(index);
    parent.setGravity(Gravity.CENTER);
    parent.setOrientation(VERTICAL);
    parent.setLayoutParams(params);
    ResCompat.setBackground(parent, item.getBackground());
    parent.setTag(item);
    parent.setOnClickListener(mMenuClickListener);
    addView(parent);

    if (item.getImage() != null)
        parent.addView(createIcon(item));

    if (!TextUtils.isEmpty(item.getText()))
        parent.addView(createTitle(item));
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:20,代码来源:SwipeMenuView.java

示例7: notifyDataSetChanged

import android.widget.LinearLayout; //导入方法依赖的package包/类
public void notifyDataSetChanged() {
    removeAllViews();
    for (int i = 0; i < objectList.size(); i++) {
        if (i < maxPills) {
            LinearLayout linear = setupPillChildView(
                    ((PillEntity) objectList.get(i)).getMessage(),
                    ((PillEntity) objectList.get(i)).isPressed(),
                    ((PillEntity) objectList.get(i)).getImgResource()
            );
            addView(linear);
            linear.setTag(i);
        }
    }
}
 
开发者ID:orbismobile,项目名称:android-MaterialPillsBox,代码行数:15,代码来源:MaterialPillsBox.java

示例8: addItem

import android.widget.LinearLayout; //导入方法依赖的package包/类
public BottomGridSheetBuilder addItem(int imageRes, CharSequence text, Object tag, @Style int style, int subscriptRes) {
    LayoutInflater inflater = LayoutInflater.from(mContext);
    // 给机会让用的人自定义ItemView
    LinearLayout itemView = (LinearLayout) inflater.inflate(R.layout.qmui_bottom_sheet_grid_item, null, false);
    // 字体加粗
    TextView titleTV = (TextView) itemView.findViewById(R.id.grid_item_title);
    if(mItemTextTypeFace != null){
        titleTV.setTypeface(mItemTextTypeFace);
    }
    titleTV.setText(text);

    itemView.setTag(tag);
    itemView.setOnClickListener(this);
    AppCompatImageView imageView = (AppCompatImageView) itemView.findViewById(R.id.grid_item_image);
    imageView.setImageResource(imageRes);

    if (subscriptRes != 0) {
        ViewStub stub = (ViewStub) itemView.findViewById(R.id.grid_item_subscript);
        View inflated = stub.inflate();
        ((ImageView) inflated).setImageResource(subscriptRes);
    }

    switch (style) {
        case FIRST_LINE:
            mFirstLineViews.append(mFirstLineViews.size(), itemView);
            break;
        case SECOND_LINE:
            mSecondLineViews.append(mSecondLineViews.size(), itemView);
            break;
    }
    return this;
}
 
开发者ID:coopese,项目名称:qmui,代码行数:33,代码来源:QMUIBottomSheet.java

示例9: instantiateItem

import android.widget.LinearLayout; //导入方法依赖的package包/类
@Override
    public Object instantiateItem(ViewGroup container, int position) {
        LinearLayout linearLayout = (LinearLayout) LayoutInflater.from(container.getContext()).inflate(R.layout.layout_child, null);
        //new LinearLayout(container.getContext());
        TextView textView = (TextView) linearLayout.findViewById(R.id.pager_textview);
        textView.setText(position + "");
        linearLayout.setId(R.id.item_id);
        switch (position) {
            case 0:
                linearLayout.setBackgroundColor(Color.parseColor("#2196F3"));
                break;
            case 1:
                linearLayout.setBackgroundColor(Color.parseColor("#673AB7"));
                break;
            case 2:
                linearLayout.setBackgroundColor(Color.parseColor("#009688"));
                break;
            case 3:
                linearLayout.setBackgroundColor(Color.parseColor("#607D8B"));
                break;
            case 4:
                linearLayout.setBackgroundColor(Color.parseColor("#F44336"));
                break;
        }
        linearLayout.setTag(TrackerConstants.VIEW_TAG_UNIQUE_NAME, "home_banner_item_" + position);
        Map<String, String> map = new HashMap();
        map.put("content", textView.getText().toString());
        linearLayout.setTag(TrackerConstants.VIEW_TAG_PARAM, map);
        container.addView(linearLayout);
//        linearLayout.getLayoutParams().width = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 180, container.getContext().getResources().getDisplayMetrics());
//        linearLayout.getLayoutParams().height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 400, container.getContext().getResources().getDisplayMetrics());
        return linearLayout;
    }
 
开发者ID:alibaba,项目名称:android_viewtracker,代码行数:34,代码来源:UltraPagerAdapter.java

示例10: onChange

import android.widget.LinearLayout; //导入方法依赖的package包/类
@Override
public void onChange() {
    if (!inRun.isFinished()) {
        inRun.stop();
    }
    int count = getTabCountInLayout();
    int newCount = mAdapter.getCount();
    views.clear();
    for (int i = 0; i < count && i < newCount; i++) {
        views.add((ViewGroup) getItemOutView(i));
    }
    removeAllViews();
    int size = views.size();
    for (int i = 0; i < newCount; i++) {
        LinearLayout result = new LinearLayout(getContext());
        View view;
        if (i < size) {
            View temp = views.get(i).getChildAt(0);
            views.get(i).removeView(temp);
            view = mAdapter.getView(i, temp, result);
        } else {
            view = mAdapter.getView(i, null, result);
        }
        if (onTransitionListener != null) {
            onTransitionListener.onTransition(view, i, i == mSelectedTabIndex ? 1 : 0);
        }
        result.addView(view);
        result.setOnClickListener(onClickListener);
        result.setTag(i);
        addView(result, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
    }
    if (centerView != null) {
        setCenterView(centerView, centerViewLayoutParams);
    }
    mPreSelectedTabIndex = -1;
    setCurrentItem(mSelectedTabIndex, false);
    measureTabs();
}
 
开发者ID:snowwolf10285,项目名称:PicShow-zhaipin,代码行数:39,代码来源:FixedIndicatorView.java

示例11: getLayoutWithTag

import android.widget.LinearLayout; //导入方法依赖的package包/类
private LinearLayout getLayoutWithTag(final String tag)
{
    LinearLayout retValue = (LinearLayout) layout.findViewWithTag(tag);
    if (retValue != null)
    {
        retValue.setTag(null);
    }
    return retValue;
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:10,代码来源:FormulaTermLoop.java

示例12: activateDay

import android.widget.LinearLayout; //导入方法依赖的package包/类
/**
 * Selects the Day on position 'index'.
 * @param index
 * @param dayLayout
 * @param check: True if checkDays() should be called.
 */
private void activateDay(int index, LinearLayout dayLayout, boolean check) {
    weekdaysSelection[index] = true;

    dayLayout.setTag(true);
    Drawable bg = ContextCompat.getDrawable(getBaseContext(), R.drawable.circle_step);
    int colorPrimary = ContextCompat.getColor(getBaseContext(), R.color.accent);
    bg.setColorFilter(new PorterDuffColorFilter(colorPrimary, PorterDuff.Mode.SRC_IN));
    dayLayout.setBackground(bg);
    TextView day = (TextView) dayLayout.findViewById(R.id.day);
    day.setTextColor(ContextCompat.getColor(getBaseContext(),R.color.md_white_1000));
    if(check) {
        checkDays();
    }
}
 
开发者ID:jcolladosp,项目名称:ePills,代码行数:21,代码来源:AddPillSetTime.java

示例13: deactivateDay

import android.widget.LinearLayout; //导入方法依赖的package包/类
/**
 * Deselects the day on position 'index'.
 * @param index
 * @param dayLayout
 * @param check: True if method checkDays() should be called.
 */
private void deactivateDay(int index, LinearLayout dayLayout, boolean check) {
    weekdaysSelection[index] = false;

    dayLayout.setTag(false);

    dayLayout.setBackgroundResource(0);

    TextView textView = dayLayout.findViewById(R.id.day);
    textView.setTextColor(ContextCompat.getColor(getBaseContext(),R.color.primary));

    if (check) {
        checkDays();
    }
}
 
开发者ID:jcolladosp,项目名称:ePills,代码行数:21,代码来源:AddPillSetTime.java

示例14: getView

import android.widget.LinearLayout; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View rowView = inflater.inflate(R.layout.sensor_list_item, parent, false);
    LinearLayout itemLayout = (LinearLayout) rowView.findViewById(R.id.item_layout);
    ImageView itemImageView = (ImageView) rowView.findViewById(R.id.item_image);
    TextView itemNameView = (TextView) rowView.findViewById(R.id.item_name);
    TextView itemStatus = (TextView) rowView.findViewById(R.id.item_status);
    ToggleButton itemEnable = (ToggleButton) rowView.findViewById(R.id.item_enable);
    ToggleButton itemActivate = (ToggleButton) rowView.findViewById(R.id.item_activate);
    Button itemActuatorRun = (Button) rowView.findViewById(R.id.item_actuator_run);
    itemActuatorRun.setVisibility(View.GONE);

    final SensorInfo sensorInfo = sensorInfos.get(position);
    itemImageView.setImageResource(sensorInfo.getType().getImage());
    itemNameView.setText(sensorInfo.getType().getNickname());
    itemEnable.setChecked(sensorInfo.isEnable());
    if (sensorInfo.getType().getCategory() == SensorType.Category.ACTUATOR) {
        itemStatus.setVisibility(View.GONE);
        itemActivate.setVisibility(View.GONE);
    }
    else {
        itemActivate.setEnabled(false);
        itemStatus.setText(sensorInfo.toString());
        itemActivate.setChecked(sensorInfo.isActivated());
    }

    // sensor item click
    itemLayout.setTag(sensorInfo);
    itemLayout.setOnClickListener(listItemClickListener);

    // sensor enable button click
    itemEnable.setTag(sensorInfo);
    itemEnable.setOnClickListener(enableClickListener);

    return rowView;
}
 
开发者ID:SKT-ThingPlug,项目名称:thingplug-sdk-android,代码行数:38,代码来源:SensorListActivity.java

示例15: getView

import android.widget.LinearLayout; //导入方法依赖的package包/类
public View getView(int position, View convertView, ViewGroup parent) {
	FollowListItem item = null;
	if (convertView == null) {
		LinearLayout llItem = new LinearLayout(parent.getContext());
		item = new FollowListItem();
		llItem.setTag(item);
		convertView = llItem;

		item.aivIcon = new AsyncImageView(getContext());
		int dp_52 = cn.sharesdk.framework.utils.R.dipToPx(getContext(), 52);
		int dp_10 = cn.sharesdk.framework.utils.R.dipToPx(parent.getContext(), 10);
		int dp_5 = cn.sharesdk.framework.utils.R.dipToPx(parent.getContext(), 5);
		LinearLayout.LayoutParams lpIcon = new LinearLayout.LayoutParams(dp_52, dp_52);
		lpIcon.gravity = Gravity.CENTER_VERTICAL;
		lpIcon.setMargins(dp_10, dp_5, dp_10, dp_5);
		item.aivIcon.setLayoutParams(lpIcon);
		llItem.addView(item.aivIcon);

		LinearLayout llText = new LinearLayout(parent.getContext());
		llText.setPadding(0, dp_10, dp_10, dp_10);
		llText.setOrientation(LinearLayout.VERTICAL);
		LinearLayout.LayoutParams lpText = new LinearLayout.LayoutParams(
				LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
		lpText.gravity = Gravity.CENTER_VERTICAL;
		lpText.weight = 1;
		llText.setLayoutParams(lpText);
		llItem.addView(llText);

		item.tvName = new TextView(parent.getContext());
		item.tvName.setTextColor(0xff000000);
		item.tvName.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
		item.tvName.setSingleLine();
		llText.addView(item.tvName);

		item.tvSign = new TextView(parent.getContext());
		item.tvSign.setTextColor(0x7f000000);
		item.tvSign.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
		item.tvSign.setSingleLine();
		llText.addView(item.tvSign);

		item.ivCheck = new ImageView(parent.getContext());
		item.ivCheck.setPadding(0, 0, dp_10, 0);
		LinearLayout.LayoutParams lpCheck = new LinearLayout.LayoutParams(
				LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
		lpCheck.gravity = Gravity.CENTER_VERTICAL;
		item.ivCheck.setLayoutParams(lpCheck);
		llItem.addView(item.ivCheck);
	} else {
		item = (FollowListItem) convertView.getTag();
	}

	Following following = getItem(position);
	item.tvName.setText(following.screeName);
	item.tvSign.setText(following.description);
	item.ivCheck.setImageBitmap(following.checked ? bmChd : bmUnch);
	if (isFling()) {
		Bitmap bm = BitmapProcessor.getBitmapFromCache(following.icon);
		if (bm != null && !bm.isRecycled()) {
			item.aivIcon.setImageBitmap(bm);
		} else {
			item.aivIcon.execute(null, AsyncImageView.DEFAULT_TRANSPARENT);
		}
	} else {
		item.aivIcon.execute(following.icon);
	}

	if (position == getCount() - 1) {
		next();
	}
	return convertView;
}
 
开发者ID:SShineTeam,项目名称:Huochexing12306,代码行数:72,代码来源:FollowList.java


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