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


Java LinearLayout.setBackgroundColor方法代码示例

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


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

示例1: setColorPreview

import android.widget.LinearLayout; //导入方法依赖的package包/类
public void setColorPreview(LinearLayout colorPreview, Integer selectedColor) {
	if (colorPreview == null)
		return;
	this.colorPreview = colorPreview;
	if (selectedColor == null)
		selectedColor = 0;
	int children = colorPreview.getChildCount();
	if (children == 0 || colorPreview.getVisibility() != View.VISIBLE)
		return;

	for (int i = 0; i < children; i++) {
		View childView = colorPreview.getChildAt(i);
		if (!(childView instanceof LinearLayout))
			continue;
		LinearLayout childLayout = (LinearLayout) childView;
		if (i == selectedColor) {
			childLayout.setBackgroundColor(Color.WHITE);
		}
		ImageView childImage = (ImageView) childLayout.findViewById(R.id.image_preview);
		childImage.setClickable(true);
		childImage.setTag(i);
		childImage.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				if (v == null)
					return;
				Object tag = v.getTag();
				if (tag == null || !(tag instanceof Integer))
					return;
				setSelectedColor((int) tag);
			}
		});
	}
}
 
开发者ID:l465659833,项目名称:Bigbang,代码行数:35,代码来源:ColorPickerView.java

示例2: setHighlightedColor

import android.widget.LinearLayout; //导入方法依赖的package包/类
private void setHighlightedColor(int previewNumber) {
	int children = colorPreview.getChildCount();
	if (children == 0 || colorPreview.getVisibility() != View.VISIBLE)
		return;

	for (int i = 0; i < children; i++) {
		View childView = colorPreview.getChildAt(i);
		if (!(childView instanceof LinearLayout))
			continue;
		LinearLayout childLayout = (LinearLayout) childView;
		if (i == previewNumber) {
			childLayout.setBackgroundColor(Color.WHITE);
		} else {
			childLayout.setBackgroundColor(Color.TRANSPARENT);
		}
	}
}
 
开发者ID:l465659833,项目名称:Bigbang,代码行数:18,代码来源:ColorPickerView.java

示例3: pickMonth

import android.widget.LinearLayout; //导入方法依赖的package包/类
/**
 * 年月选择对话框
 *
 * @param con
 * @param title
 * @param calendar
 * @param listener
 */
public static void pickMonth(Context con, String title, Calendar calendar, final OnDateSetListener listener) {
    LinearLayout ll = new LinearLayout(con);
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    ll.setLayoutParams(layoutParams);
    ll.setOrientation(LinearLayout.VERTICAL);
    //添加一条线
    LinearLayout line = new LinearLayout(con);
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 1);
    line.setBackgroundColor(con.getResources().getColor(R.color.line));
    line.setLayoutParams(lp);
    ll.addView(line);
    //添加选择器控件
    final DatePicker datePicker = new DatePicker(con, null, themeId);
    datePicker.setLayoutParams(layoutParams);
    datePicker.init(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), null);
    datePicker.setCalendarViewShown(false);
    ll.addView(datePicker);
    //初始化对话框
    QuickDialog.Builder builder = new QuickDialog.Builder(con);
    builder.setContentView(ll);
    builder.setTitle(title);
    builder.setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
            listener.onDateSet(datePicker, datePicker.getYear(), datePicker.getMonth(), datePicker.getDayOfMonth());
        }
    });
    builder.create().show();
}
 
开发者ID:quickhybrid,项目名称:quickhybrid-android,代码行数:39,代码来源:DialogUtil.java

示例4: setStatusGone

import android.widget.LinearLayout; //导入方法依赖的package包/类
/**
 * 隐藏状态栏(适用于背景图片延伸到状态栏的情况)
 * @param bar
 */
public static void setStatusGone(LinearLayout bar, boolean isBackGround, int color) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT
                , LinearLayout.LayoutParams.WRAP_CONTENT);
        params.setMargins(0, statusHeight, 0, 0);
        bar.setLayoutParams(params);
        if (isBackGround) {
            bar.setBackgroundColor(bar.getContext().getResources().getColor(color));
        }
    }
}
 
开发者ID:forplane,项目名称:head,代码行数:16,代码来源:ToolBarStatusUtils.java

示例5: ComputerPartViewHolder

import android.widget.LinearLayout; //导入方法依赖的package包/类
public ComputerPartViewHolder(View view) {
    super(view);
    cardView = (CardView)view.findViewById(R.id.card_view);
    //TODO change the image programatically
    computer_part_img = (ImageView)view.findViewById(R.id.card_view_img);

    LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.card_view_linear_layout);
    textViews = new TextView[ComputerPartAdapter.listSize + 1]; //for space
    for (int i = 0; i < textViews.length; i++) {
        textViews[i] = new TextView(view.getContext());
        linearLayout.setBackgroundColor(Color.TRANSPARENT);
        linearLayout.addView(textViews[i]);
    }
}
 
开发者ID:asdiamond,项目名称:CodeMineProject1,代码行数:15,代码来源:ComputerPartAdapter.java

示例6: initBottom

import android.widget.LinearLayout; //导入方法依赖的package包/类
private void initBottom(LinearLayout llBottom, float ratio) {
	LinearLayout llAt = new LinearLayout(activity);
	llAt.setPadding(0, 0, 0, 5);
	llAt.setBackgroundColor(0xffffffff);
	int bottomHeight = (int) (DESIGN_BOTTOM_HEIGHT * ratio);
	LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, bottomHeight);
	llBottom.addView(llAt, lp);

	tvAt = new TextView(activity);
	tvAt.setTextColor(0xff3b3b3b);
	tvAt.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22);
	tvAt.setGravity(Gravity.BOTTOM);
	tvAt.setText("@");
	int padding = (int) (DESIGN_LEFT_PADDING * ratio);
	tvAt.setPadding(padding, 0, padding, 0);
	lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
	llAt.addView(tvAt, lp);
	tvAt.setOnClickListener(this);
	if (isShowAtUserLayout(platform.getName())) {
		tvAt.setVisibility(View.VISIBLE);
	} else {
		tvAt.setVisibility(View.INVISIBLE);
	}

	tvTextCouter = new TextView(activity);
	tvTextCouter.setTextColor(0xff3b3b3b);
	tvTextCouter.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21);
	tvTextCouter.setGravity(Gravity.BOTTOM | Gravity.RIGHT);
	onTextChanged(etContent.getText(), 0, 0, 0);
	tvTextCouter.setPadding(padding, 0, padding, 0);
	lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
	lp.weight = 1;
	llAt.addView(tvTextCouter, lp);

	View v = new View(activity);
	v.setBackgroundColor(0xffcccccc);
	int px_1 = ratio > 1 ? ((int) ratio) : 1;
	lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, px_1);
	llBottom.addView(v, lp);
}
 
开发者ID:Jusenr,项目名称:androidgithub,代码行数:41,代码来源:EditPagePort.java

示例7: initBottom

import android.widget.LinearLayout; //导入方法依赖的package包/类
private void initBottom(LinearLayout llBottom, float ratio) {
	LinearLayout llAt = new LinearLayout(activity);
	llAt.setPadding(0, 0, 0, 5);
	llAt.setBackgroundColor(0xffffffff);
	int bottomHeight = (int) (DESIGN_BOTTOM_HEIGHT * ratio);
	LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, bottomHeight);
	llBottom.addView(llAt, lp);

	tvAt = new TextView(activity);
	tvAt.setTextColor(0xff3b3b3b);
	tvAt.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21);
	tvAt.setGravity(Gravity.BOTTOM);
	tvAt.setText("@");
	int padding = (int) (DESIGN_LEFT_PADDING * ratio);
	tvAt.setPadding(padding, 0, padding, 0);
	lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
	llAt.addView(tvAt, lp);
	tvAt.setOnClickListener(this);
	if (isShowAtUserLayout(platform.getName())) {
		tvAt.setVisibility(View.VISIBLE);
	} else {
		tvAt.setVisibility(View.INVISIBLE);
	}

	tvTextCouter = new TextView(activity);
	tvTextCouter.setTextColor(0xff3b3b3b);
	tvTextCouter.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
	tvTextCouter.setGravity(Gravity.BOTTOM | Gravity.RIGHT);
	onTextChanged(etContent.getText(), 0, 0, 0);
	tvTextCouter.setPadding(padding, 0, padding, 0);
	lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
	lp.weight = 1;
	llAt.addView(tvTextCouter, lp);

	View v = new View(activity);
	v.setBackgroundColor(0xffcccccc);
	int px1 = ratio > 1 ? ((int) ratio) : 1;
	lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, px1);
	llBottom.addView(v, lp);
}
 
开发者ID:AndroidBoySC,项目名称:Mybilibili,代码行数:41,代码来源:EditPageLand.java

示例8: DropDownMenu

import android.widget.LinearLayout; //导入方法依赖的package包/类
public DropDownMenu(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    setOrientation(VERTICAL);

    //为DropDownMenu添加自定义属性
    int menuBackgroundColor = 0xffffffff;
    int underlineColor = 0xffcccccc;
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DropDownMenu);
    underlineColor = a.getColor(R.styleable.DropDownMenu_ddunderlineColor, underlineColor);
    dividerColor = a.getColor(R.styleable.DropDownMenu_dddividerColor, dividerColor);
    textSelectedColor = a.getColor(R.styleable.DropDownMenu_ddtextSelectedColor, textSelectedColor);
    textUnselectedColor = a.getColor(R.styleable.DropDownMenu_ddtextUnselectedColor, textUnselectedColor);
    menuBackgroundColor = a.getColor(R.styleable.DropDownMenu_ddmenuBackgroundColor, menuBackgroundColor);
    maskColor = a.getColor(R.styleable.DropDownMenu_ddmaskColor, maskColor);
    menuTextSize = a.getDimensionPixelSize(R.styleable.DropDownMenu_ddmenuTextSize, menuTextSize);
    menuSelectedIcon = a.getResourceId(R.styleable.DropDownMenu_ddmenuSelectedIcon, menuSelectedIcon);
    menuUnselectedIcon = a.getResourceId(R.styleable.DropDownMenu_ddmenuUnselectedIcon, menuUnselectedIcon);
    a.recycle();

    //初始化tabMenuView并添加到tabMenuView
    tabMenuView = new LinearLayout(context);
    LayoutParams params = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    tabMenuView.setOrientation(HORIZONTAL);
    tabMenuView.setBackgroundColor(menuBackgroundColor);
    tabMenuView.setLayoutParams(params);
    addView(tabMenuView, 0);

    //为tabMenuView添加下划线
    View underLine = new View(getContext());
    underLine.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dpTpPx(1.0f)));
    underLine.setBackgroundColor(underlineColor);
    addView(underLine, 1);

    //初始化containerView并将其添加到DropDownMenu
    containerView = new FrameLayout(context);
    containerView.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT));
    addView(containerView, 2);

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:41,代码来源:DropDownMenu.java

示例9: showMultiMenuDialog

import android.widget.LinearLayout; //导入方法依赖的package包/类
/**
 * 多选对话框
 *
 * @param con        上下文
 * @param title      标题
 * @param cancelable 是否可取消
 * @param meumList   选项,key值必须包涵text,isChecked
 * @param listener   点击确认按钮
 */
public static void showMultiMenuDialog(Context con, String title, boolean cancelable, List<HashMap<String, Object>> meumList, DialogInterface.OnClickListener listener) {
    //创建自定义布局
    LinearLayout ll = new LinearLayout(con);
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    ll.setLayoutParams(layoutParams);
    ll.setOrientation(LinearLayout.VERTICAL);
    //添加一条线
    LinearLayout line = new LinearLayout(con);
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 1);
    line.setBackgroundColor(con.getResources().getColor(R.color.line));
    line.setLayoutParams(lp);
    ll.addView(line);
    //添加列表布局
    ListView lv = new ListView(con);
    lv.setLayoutParams(layoutParams);
    final DialogSelectAdapter adapter = new DialogSelectAdapter(con, meumList, true);
    lv.setAdapter(adapter);
    lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            adapter.onItemClick(view, position);
        }
    });
    ll.addView(lv);
    //创建对话框
    QuickDialog.Builder builder = new QuickDialog.Builder(con);
    builder.setContentView(ll);
    builder.setTitle(title);
    builder.setGravity(Gravity.LEFT);
    builder.setCancelable(cancelable);
    builder.setPositiveButton("确定", listener);
    builder.setNegativeButton("取消", null);
    builder.create().show();
}
 
开发者ID:quickhybrid,项目名称:quickhybrid-android,代码行数:44,代码来源:DialogUtil.java

示例10: initBottom

import android.widget.LinearLayout; //导入方法依赖的package包/类
private void initBottom(LinearLayout llBottom, float ratio) {
	LinearLayout llAt = new LinearLayout(activity);
	llAt.setPadding(0, 0, 0, 5);
	llAt.setBackgroundColor(0xffffffff);
	int bottomHeight = (int) (DESIGN_BOTTOM_HEIGHT * ratio);
	LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, bottomHeight);
	llBottom.addView(llAt, lp);

	tvAt = new TextView(activity);
	tvAt.setTextColor(0xff3b3b3b);
	tvAt.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22);
	tvAt.setGravity(Gravity.BOTTOM);
	tvAt.setText("@");
	int padding = (int) (DESIGN_LEFT_PADDING * ratio);
	tvAt.setPadding(padding, 0, padding, 0);
	lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
	llAt.addView(tvAt, lp);
	tvAt.setOnClickListener(this);
	if (isShowAtUserLayout(platform.getName())) {
		tvAt.setVisibility(View.VISIBLE);
	} else {
		tvAt.setVisibility(View.INVISIBLE);
	}

	tvTextCouter = new TextView(activity);
	tvTextCouter.setTextColor(0xff3b3b3b);
	tvTextCouter.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21);
	tvTextCouter.setGravity(Gravity.BOTTOM | Gravity.RIGHT);
	onTextChanged(etContent.getText(), 0, 0, 0);
	tvTextCouter.setPadding(padding, 0, padding, 0);
	lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
	lp.weight = 1;
	llAt.addView(tvTextCouter, lp);

	View v = new View(activity);
	v.setBackgroundColor(0xffcccccc);
	int px1 = ratio > 1 ? ((int) ratio) : 1;
	lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, px1);
	llBottom.addView(v, lp);
}
 
开发者ID:AndroidBoySC,项目名称:Mybilibili,代码行数:41,代码来源:EditPagePort.java

示例11: AlbumView

import android.widget.LinearLayout; //导入方法依赖的package包/类
public AlbumView(Context context) {
    super(context);

    imageView = new BackupImageView(context);
    addView(imageView,
            LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));

    LinearLayout linearLayout = new LinearLayout(context);
    linearLayout.setOrientation(LinearLayout.HORIZONTAL);
    linearLayout.setBackgroundColor(0x7f000000);
    addView(linearLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 28,
            Gravity.LEFT | Gravity.BOTTOM));

    nameTextView = new TextView(context);
    nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    nameTextView.setTextColor(0xffffffff);
    nameTextView.setSingleLine(true);
    nameTextView.setEllipsize(TextUtils.TruncateAt.END);
    nameTextView.setMaxLines(1);
    nameTextView.setGravity(Gravity.CENTER_VERTICAL);
    linearLayout.addView(nameTextView,
            LayoutHelper.createLinear(0, LayoutHelper.MATCH_PARENT, 1.0f, 8, 0, 0, 0));

    countTextView = new TextView(context);
    countTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    countTextView.setTextColor(0xffaaaaaa);
    countTextView.setSingleLine(true);
    countTextView.setEllipsize(TextUtils.TruncateAt.END);
    countTextView.setMaxLines(1);
    countTextView.setGravity(Gravity.CENTER_VERTICAL);
    linearLayout.addView(countTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT,
            LayoutHelper.MATCH_PARENT, 4, 0, 4, 0));

    selector = new View(context);
    selector.setBackgroundResource(R.drawable.list_selector);
    addView(selector,
            LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
}
 
开发者ID:chengzichen,项目名称:KrGallery,代码行数:39,代码来源:PhotoPickerAlbumsCell.java

示例12: onPostCreate

import android.widget.LinearLayout; //导入方法依赖的package包/类
@Override
protected void onPostCreate(Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);
    LinearLayout root = (LinearLayout)findViewById(android.R.id.list)
            .getParent().getParent().getParent();
    Toolbar bar = (Toolbar) LayoutInflater.from(this).inflate(
            R.layout.toolbar_settings, root, false);
    root.addView(bar, 0); // insert at top
    bar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();
        }
    });

    //Color fix
    getListView().setCacheColorHint(ContextCompat.getColor(this, R.color.drawer_background));
    getListView().setBackgroundColor(ContextCompat.getColor(this, R.color.drawer_background));
    root.setBackgroundColor(ContextCompat.getColor(this, R.color.drawer_background));

    setTheme(R.style.PreferenceDark);
    if(Build.VERSION.SDK_INT >= 21) { //Lollipop
        Window window = getWindow();
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        window.setStatusBarColor(ContextCompat.getColor(this, R.color.colorPrimaryDarkPrefs));
    }
}
 
开发者ID:Light-Team,项目名称:ModPE-IDE-Source,代码行数:29,代码来源:LModPreferencesActivity.java

示例13: initBottom

import android.widget.LinearLayout; //导入方法依赖的package包/类
private void initBottom(LinearLayout llBottom, float ratio) {
	LinearLayout llAt = new LinearLayout(activity);
	llAt.setPadding(0, 0, 0, 5);
	llAt.setBackgroundColor(0xffffffff);
	int bottomHeight = (int) (DESIGN_BOTTOM_HEIGHT * ratio);
	LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, bottomHeight);
	llBottom.addView(llAt, lp);

	tvAt = new TextView(activity);
	tvAt.setTextColor(0xff3b3b3b);
	tvAt.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21);
	tvAt.setGravity(Gravity.BOTTOM);
	tvAt.setText("@");
	int padding = (int) (DESIGN_LEFT_PADDING * ratio);
	tvAt.setPadding(padding, 0, padding, 0);
	lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
	llAt.addView(tvAt, lp);
	tvAt.setOnClickListener(this);
	if (isShowAtUserLayout(platform.getName())) {
		tvAt.setVisibility(View.VISIBLE);
	} else {
		tvAt.setVisibility(View.INVISIBLE);
	}

	tvTextCouter = new TextView(activity);
	tvTextCouter.setTextColor(0xff3b3b3b);
	tvTextCouter.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
	tvTextCouter.setGravity(Gravity.BOTTOM | Gravity.RIGHT);
	onTextChanged(etContent.getText(), 0, 0, 0);
	tvTextCouter.setPadding(padding, 0, padding, 0);
	lp = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
	lp.weight = 1;
	llAt.addView(tvTextCouter, lp);

	View v = new View(activity);
	v.setBackgroundColor(0xffcccccc);
	int px_1 = ratio > 1 ? ((int) ratio) : 1;
	lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, px_1);
	llBottom.addView(v, lp);
}
 
开发者ID:yiwent,项目名称:Mobike,代码行数:41,代码来源:EditPageLand.java

示例14: getView

import android.widget.LinearLayout; //导入方法依赖的package包/类
@Override
        public View getView(final int position, View convertView, final ViewGroup parent) {
            ViewHolder holder = null;
            if (convertView == null) {
                holder = new ViewHolder();
                convertView = LayoutInflater.from(getContext()).inflate(res, null);
                holder.imageView = (ImageView) convertView.findViewById(R.id.iv_avatar);
                holder.textView = (TextView) convertView.findViewById(R.id.tv_name);
                holder.badgeDeleteView = (ImageView) convertView.findViewById(R.id.badge_delete);
                convertView.setTag(holder);
            } else {
                holder = (ViewHolder) convertView.getTag();
            }

            final LinearLayout button = (LinearLayout) convertView.findViewById(R.id.button_avatar);

            final String username = getItem(position);
            convertView.setVisibility(View.VISIBLE);
            button.setVisibility(View.VISIBLE);
            EaseUserUtils.setUserNick(username, holder.textView);
            EaseUserUtils.setUserAvatar(getContext(), username, holder.imageView);

            LinearLayout id_background = (LinearLayout) convertView.findViewById(R.id.l_bg_id);
            id_background.setBackgroundColor(convertView.getResources().getColor(
                    position == 0 ? R.color.holo_red_light : R.color.holo_orange_light));
            button.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
//                    if (!isCurrentOwner(group)) {
//                        return;
//                    }
//                    if (username.equals(group.getOwner())) {
//                        return;
//                    }
//                    operationUserId = username;
//                    Dialog dialog = createMemberMenuDialog();
//                    dialog.show();
//
//                    boolean[] adminVisibilities = {
//                            true,       //R.id.menu_item_transfer_owner,
//                            false,      //R.id.menu_item_add_admin,
//                            true,       //R.id.menu_item_rm_admin,
//                            false,      //R.id.menu_item_remove_member,
//                            false,      //R.id.menu_item_add_to_blacklist,
//                            false,      //R.id.menu_item_remove_from_blacklist,
//                            false,      //R.id.menu_item_mute,
//                            false,      //R.id.menu_item_unmute
//                    };
//                    try {
//                        setVisibility(dialog, ids, adminVisibilities);
//                    } catch (Exception e) {
//                        e.printStackTrace();
//                    }
                }
            });
            return convertView;
        }
 
开发者ID:mangestudio,项目名称:GCSApp,代码行数:58,代码来源:GroupDetailsActivity.java

示例15: onCreate

import android.widget.LinearLayout; //导入方法依赖的package包/类
public void onCreate() {
    LinearLayout llPage = new LinearLayout(getContext());
    llPage.setBackgroundColor(-657931);
    llPage.setOrientation(1);
    this.activity.setContentView(llPage);
    this.llTitle = new TitleLayout(getContext());
    int resId = R.getBitmapRes(getContext(), "title_back");
    if (resId > 0) {
        this.llTitle.setBackgroundResource(resId);
    }
    this.llTitle.getBtnBack().setOnClickListener(this);
    resId = R.getStringRes(getContext(), "multi_share");
    if (resId > 0) {
        this.llTitle.getTvTitle().setText(resId);
    }
    this.llTitle.getBtnRight().setVisibility(0);
    resId = R.getStringRes(getContext(), SportPlanFragment.COURSE_STATUS_FINISH);
    if (resId > 0) {
        this.llTitle.getBtnRight().setText(resId);
    }
    this.llTitle.getBtnRight().setOnClickListener(this);
    this.llTitle.setLayoutParams(new LayoutParams(-1, -2));
    llPage.addView(this.llTitle);
    FrameLayout flPage = new FrameLayout(getContext());
    LayoutParams lpFl = new LayoutParams(-1, -2);
    lpFl.weight = 1.0f;
    flPage.setLayoutParams(lpFl);
    llPage.addView(flPage);
    PullToRefreshView followList = new PullToRefreshView(getContext());
    followList.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
    flPage.addView(followList);
    this.adapter = new FollowAdapter(followList);
    this.adapter.setPlatform(this.platform);
    followList.setAdapter(this.adapter);
    this.adapter.getListView().setOnItemClickListener(this);
    ImageView ivShadow = new ImageView(getContext());
    resId = R.getBitmapRes(getContext(), "title_shadow");
    if (resId > 0) {
        ivShadow.setBackgroundResource(resId);
    }
    ivShadow.setLayoutParams(new FrameLayout.LayoutParams(-1, -2));
    flPage.addView(ivShadow);
    followList.performPulling(true);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:45,代码来源:FollowListPage.java


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