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