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


Java LinearLayout.setBackgroundDrawable方法代码示例

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


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

示例1: addItem

import android.widget.LinearLayout; //导入方法依赖的package包/类
private void addItem(SwipeMenuItem item, int id) {
	LayoutParams params = new LayoutParams(item.getWidth(),
			LayoutParams.MATCH_PARENT);
	LinearLayout parent = new LinearLayout(getContext());
	parent.setId(id);
	parent.setGravity(Gravity.CENTER);
	parent.setOrientation(LinearLayout.VERTICAL);
	parent.setLayoutParams(params);
	parent.setBackgroundDrawable(item.getBackground());
	parent.setOnClickListener(this);
	addView(parent);

	if (item.getIcon() != null) {
		parent.addView(createIcon(item));
	}
	if (!TextUtils.isEmpty(item.getTitle())) {
		parent.addView(createTitle(item));
	}

}
 
开发者ID:MedicationReminder,项目名称:MedicationReminder,代码行数:21,代码来源:SwipeMenuView.java

示例2: addItem

import android.widget.LinearLayout; //导入方法依赖的package包/类
private void addItem(SwipeMenuItem item, int id) {
	LayoutParams params = new LayoutParams(item.getWidth(),
			LayoutParams.MATCH_PARENT);
	LinearLayout parent = new LinearLayout(getContext());
	parent.setId(id);
	parent.setGravity(Gravity.CENTER);
	parent.setOrientation(LinearLayout.VERTICAL);
	parent.setLayoutParams(params);
	parent.setBackgroundDrawable(item.getBackground());
	parent.setOnClickListener(this);

	addView(parent);

	if (item.getIcon() != null) {
		parent.addView(createIcon(item));
	}
	if (!TextUtils.isEmpty(item.getTitle())) {
		parent.addView(createTitle(item));
	}

}
 
开发者ID:heynchy,项目名称:SwipeMenuAndPullToRefresh,代码行数:22,代码来源:SMExpandView.java

示例3: modifyUniformBlueStyle

import android.widget.LinearLayout; //导入方法依赖的package包/类
public static void modifyUniformBlueStyle(BasePageWithTitle basepage) {
	if (basepage == null) {
		return;
	}
	Context context = basepage.getContext();
	TitleBar titlebar = basepage.getTitleBar();
	LinearLayout mainlayout = basepage.getMainLayout();
	if (titlebar == null) {
		throw new IllegalArgumentException("titleBar is not initialized!");
	} else {
		titlebar.setBackgroundColor(Color.TRANSPARENT);
		titlebar.getTitleTextView().setTextColor(context.getResources().getColor(basepage.getColorId("bbs_white")));
		setTextSize(titlebar.getTitleTextView(), "bbs_theme0_title_txt_size");
	}

	if (mainlayout == null) {
		throw new IllegalArgumentException("mainLayout is not initialized!");
	} else {
		Drawable drawable = context.getResources().getDrawable(basepage.getDrawableId("bbs_theme0_bg_userpage"));
		if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) {
			mainlayout.setBackgroundDrawable(drawable);
		} else {
			mainlayout.setBackground(drawable);
		}
	}
	basepage.setStatusBarColor(context.getResources().getColor(basepage.getColorId("bbs_theme0_statusbar_blue")));
}
 
开发者ID:MobClub,项目名称:BBSSDK-for-Android,代码行数:28,代码来源:Theme0StyleModifier.java

示例4: modifyUniformWhiteStyle

import android.widget.LinearLayout; //导入方法依赖的package包/类
public static void modifyUniformWhiteStyle(BasePageWithTitle basepage) {
	if (basepage == null) {
		return;
	}
	Context context = basepage.getContext();
	TitleBar titlebar = basepage.getTitleBar();
	LinearLayout mainlayout = basepage.getMainLayout();
	if (titlebar == null) {
		throw new IllegalArgumentException("titleBar is not initialized!");
	} else {
		titlebar.setBackgroundColor(Color.TRANSPARENT);
		if(titlebar.getTitleTextView() != null) {
			titlebar.getTitleTextView().setTextColor(context.getResources().getColor(basepage.getColorId("bbs_theme0_pagetext")));
			setTextSize(titlebar.getTitleTextView(), "bbs_theme0_title_txt_size");
		}
	}

	if (mainlayout == null) {
		throw new IllegalArgumentException("mainLayout is not initialized!");
	} else {
		ColorDrawable drawable = new ColorDrawable(context.getResources().getColor(basepage.getColorId("bbs_white")));
		if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) {
			mainlayout.setBackgroundDrawable(drawable);
		} else {
			mainlayout.setBackground(drawable);
		}
	}
	basepage.setStatusBarColor(BBSViewBuilder.getInstance().getStatusBarColor(context));
}
 
开发者ID:MobClub,项目名称:BBSSDK-for-Android,代码行数:30,代码来源:Theme0StyleModifier.java

示例5: modifyUniformWhiteStyle

import android.widget.LinearLayout; //导入方法依赖的package包/类
public static void modifyUniformWhiteStyle(BasePageWithTitle basepage) {
	if (basepage == null) {
		return;
	}
	Context context = basepage.getContext();
	TitleBar titlebar = basepage.getTitleBar();
	LinearLayout mainlayout = basepage.getMainLayout();
	if (titlebar == null) {
		throw new IllegalArgumentException("titleBar is not initialized!");
	} else {
		titlebar.setBackgroundColor(Color.TRANSPARENT);
		if(titlebar.getTitleTextView() != null) {
			titlebar.getTitleTextView().setTextColor(context.getResources().getColor(basepage.getColorId("bbs_theme1_pagetext")));
			setTextSize(titlebar.getTitleTextView(), "bbs_theme1_title_txt_size");
		}
	}

	if (mainlayout == null) {
		throw new IllegalArgumentException("mainLayout is not initialized!");
	} else {
		ColorDrawable drawable = new ColorDrawable(context.getResources().getColor(basepage.getColorId("bbs_white")));
		if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) {
			mainlayout.setBackgroundDrawable(drawable);
		} else {
			mainlayout.setBackground(drawable);
		}
	}
	basepage.setStatusBarColor(context.getResources().getColor(basepage.getColorId("bbs_theme1_statusbar")));
}
 
开发者ID:MobClub,项目名称:BBSSDK-for-Android,代码行数:30,代码来源:Theme1StyleModifier.java

示例6: onCreate

import android.widget.LinearLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(ResHelper.getLayoutRes(this, "bbs_theme1_activity_another"));
	layoutContainer = (LinearLayout) findViewById(ResHelper.getIdRes(this, "layoutContainer"));
	Drawable drawable = new BitmapDrawable(getResources(), BlurEffectManager.getInstance().getBlurFrontPage());
	layoutContainer.setBackgroundDrawable(drawable);
}
 
开发者ID:MobClub,项目名称:BBSSDK-for-Android,代码行数:9,代码来源:AnotherActivity.java

示例7: getMode

import android.widget.LinearLayout; //导入方法依赖的package包/类
/**
     * 获取单个课表View
     *
     * @param model 数据类型
     * @return
     */
    @SuppressWarnings("deprecation")
    private View getMode(final Schedule model) {
        LinearLayout mScheduleView = new LinearLayout(getContext());
        mScheduleView.setOrientation(VERTICAL);
        TextView mTimeTableNameView = new TextView(getContext());
        int num = model.getEndSec() - model.getStartSec();
        mTimeTableNameView.setHeight(dip2px((num + 1) * TimeTableHeight) + num * 2);
        mTimeTableNameView.setTextColor(getContext().getResources().getColor(
                android.R.color.white));
        mTimeTableNameView.setWidth(dip2px(50));
        mTimeTableNameView.setTextSize(CourseTextSize);
        mTimeTableNameView.setGravity(Gravity.CENTER);
        mTimeTableNameView.setText(model.getName() + "\n" + model.getLocation());
        mScheduleView.addView(mTimeTableNameView);
        mScheduleView.addView(getWeekTransverseLine());
        mScheduleView.setBackgroundDrawable(getContext().getResources()
                .getDrawable(colors[getColorNum(model.getName())]));

        if(mCurrentWeek != FileUtils.SP_WEEK_NOT_SET && !CalcUtils.isCurrentWeek(model.getPeriod(), mCurrentWeek)){
            mScheduleView.setBackgroundDrawable(getContext().getResources()
                    .getDrawable(notGocolors));
//            mTimeTableNameView.setTextColor(getContext().getResources().getColor(
//                    android.R.color.darker_gray));
        }

        mScheduleView.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
//                Toast.makeText(getContext(), model.getName() + "\n" + model.getLocation()+"\n" +model.getPeriod()+"\n"+ model.getTeacher(), Toast.LENGTH_SHORT).show();
                //TODO 编辑课程
                mClickListener.onClickScheduleEdit(model);
            }
        });
        return mScheduleView;
    }
 
开发者ID:WeGdufe,项目名称:MovingGdufe-Android,代码行数:42,代码来源:ScheduleView.java

示例8: getView

import android.widget.LinearLayout; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    final DialogMenuItem item = contents.get(position);

    LinearLayout ll_item = new LinearLayout(context);
    ll_item.setOrientation(LinearLayout.HORIZONTAL);
    ll_item.setGravity(Gravity.CENTER_VERTICAL);

    ImageView iv_item = new ImageView(context);
    iv_item.setPadding(0, 0, dp2px(15), 0);
    ll_item.addView(iv_item);

    TextView tv_item = new TextView(context);
    tv_item.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.WRAP_CONTENT));
    tv_item.setSingleLine(true);
    tv_item.setTextColor(itemTextColor);
    tv_item.setTextSize(TypedValue.COMPLEX_UNIT_SP, itemTextSize_SP);

    ll_item.addView(tv_item);
    float radius = dp2px(cornerRadius_DP);
    if (isTitleShow) {
        ll_item.setBackgroundDrawable((CornerUtils.listItemSelector(radius, Color.TRANSPARENT, itemPressColor,
                position == contents.size() - 1)));
    } else {
        ll_item.setBackgroundDrawable(CornerUtils.listItemSelector(radius, Color.TRANSPARENT, itemPressColor,
                contents.size(), position));
    }

    int left = item.resId == 0 ? dp2px(18) : dp2px(16);
    int top = dp2px(10);
    int right = 0;
    int bottom = dp2px(10);
    ll_item.setPadding(left + itemExtraLeft, top + itemExtraTop, right + itemExtraRight, bottom + itemExtraBottom);

    iv_item.setImageResource(item.resId);
    tv_item.setText(item.operName);
    iv_item.setVisibility(item.resId == 0 ? View.GONE : View.VISIBLE);

    return ll_item;
}
 
开发者ID:Luodian,项目名称:Shared-Route,代码行数:43,代码来源:NormalListDialog.java

示例9: initView

import android.widget.LinearLayout; //导入方法依赖的package包/类
/**
 * 密码键盘默认样式
 * @param context
 */
private void initView(Context context) {
    mkeyboardLayout = new LinearLayout(context);
    mkeyboardLayout.setOrientation(LinearLayout.VERTICAL);
    if (null != mKeyBoardBgDrawable) {
        mkeyboardLayout.setBackgroundDrawable(mKeyBoardBgDrawable);
    } else {
        mkeyboardLayout.setBackgroundColor(Color.GRAY);
    }
    LinearLayout.LayoutParams titleParams = new LinearLayout.LayoutParams(
            LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    titleParams.setMargins(0, 0, 0, 6);
    mTitleLayout = new LinearLayout(context);
    mTitleLayout.setGravity(Gravity.CENTER);
    mTitleLayout.setOrientation(LinearLayout.HORIZONTAL);

    mTitleLayout.setLayoutParams(titleParams);
    int titleBackgroundColor = mContext.getResources()
            .getColor(R.color.bg_security_keyboard_title);
    mTitleLayout.setBackgroundColor(titleBackgroundColor);
    mTitleView = new TextView(context);
    mTitleView.setText("Secure Mode");
    mTitleView.setTextColor(Color.WHITE);
    mTitleView.setHeight(getSaftyKeyHeight() / 16);
    mTitleView.setGravity(Gravity.CENTER);
    mTitleLayout.addView(mTitleView);

    mKeyBoardControl = new GrapeGridview(context);
    mKeyBoardControl.setHorizontalScrollBarEnabled(false);
    mKeyBoardControl.setVerticalScrollBarEnabled(false);
    mKeyBoardControl.setEnabled(false);
    mKeyBoardControl.setNumColumns(Constant.COLUMN_SOFT_KEYBOARD);
    mKeyBoardControl.setVerticalSpacing(mMarginRow);
    mKeyBoardControl.setHorizontalSpacing(mMarginCol);
    mKeyBoardControl.setAdapter(mAdapter);

    mkeyboardLayout.addView(mTitleLayout);
    mkeyboardLayout.addView(mKeyBoardControl);
    mkeyboardLayout.setPadding(mPaddingLeft, mPaddingTop, mPaddingRight,
            mPaddingBottom);

    mPopup = new PopupWindow(mkeyboardLayout, mWidth, mHeight);
    mPopup.setBackgroundDrawable(new BitmapDrawable());
    mPopup.setSoftInputMode(
            WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
    mPopup.setOutsideTouchable(true);
    mPopup.setFocusable(true);
    mPopup.setOnDismissListener(dismissListener);
}
 
开发者ID:VigorousLiang,项目名称:PWEditText-SafeKeyboard,代码行数:53,代码来源:SafetyKeyboard.java

示例10: initPageView

import android.widget.LinearLayout; //导入方法依赖的package包/类
private void initPageView() {
	flPage = new FrameLayout(getContext());
	flPage.setOnClickListener(this);
	flPage.setBackgroundDrawable(new ColorDrawable(0x55000000));

	// container of the platform gridview
	llPage = new LinearLayout(getContext()) {
		public boolean onTouchEvent(MotionEvent event) {
			return true;
		}
	};
	llPage.setOrientation(LinearLayout.VERTICAL);
	llPage.setBackgroundDrawable(new ColorDrawable(0xffffffff));
	FrameLayout.LayoutParams lpLl = new FrameLayout.LayoutParams(
			FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT);
	lpLl.gravity = Gravity.BOTTOM;
	llPage.setLayoutParams(lpLl);
	flPage.addView(llPage);

	// gridview
	grid = new PlatformGridView(getContext());
	grid.setEditPageBackground(getBackgroundView());
	LinearLayout.LayoutParams lpWg = new LinearLayout.LayoutParams(
			LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
	grid.setLayoutParams(lpWg);
	llPage.addView(grid);

	// cancel button
	btnCancel = new Button(getContext());
	btnCancel.setTextColor(0xff3a65ff);
	btnCancel.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20);
	int resId = getStringRes(getContext(), "cancel");
	if (resId > 0) {
		btnCancel.setText(resId);
	}
	btnCancel.setPadding(0, 0, 0, com.mob.tools.utils.R.dipToPx(getContext(), 5));

	resId = getBitmapRes(getContext(), "classic_platform_corners_bg");
	if(resId > 0){
		btnCancel.setBackgroundResource(resId);
	}else {
	    btnCancel.setBackgroundDrawable(new ColorDrawable(0xffffffff));
	}

	LinearLayout.LayoutParams lpBtn = new LinearLayout.LayoutParams(
			LinearLayout.LayoutParams.MATCH_PARENT, com.mob.tools.utils.R.dipToPx(getContext(), 45));
	int dp_10 = com.mob.tools.utils.R.dipToPx(getContext(), 10);
	lpBtn.setMargins(dp_10, dp_10, dp_10, dp_10);
	btnCancel.setLayoutParams(lpBtn);
	llPage.addView(btnCancel);
}
 
开发者ID:liupengandroid,项目名称:ywApplication,代码行数:52,代码来源:PlatformListPage.java

示例11: PickerBottomLayout

import android.widget.LinearLayout; //导入方法依赖的package包/类
public PickerBottomLayout(Context context, boolean darkTheme) {
    super(context);
    isDarkTheme = darkTheme;

    setBackgroundColor(isDarkTheme ? 0xff1a1a1a : 0xffffffff);

    cancelButton = new TextView(context);
    cancelButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    cancelButton.setTextColor(isDarkTheme ? 0xffffffff : 0xff19a7e8);
    cancelButton.setGravity(Gravity.CENTER);
    cancelButton.setBackgroundDrawable(Theme.createBarSelectorDrawable(isDarkTheme ? Theme.ACTION_BAR_PICKER_SELECTOR_COLOR : Theme.ACTION_BAR_AUDIO_SELECTOR_COLOR, false));
    cancelButton.setPadding(AndroidUtilities.dp(29), 0, AndroidUtilities.dp(29), 0);
    cancelButton.setText(LocaleController.getString("Cancel", R.string.Cancel).toUpperCase());
    cancelButton.setTypeface(FontManager.instance().getTypeface());
    addView(cancelButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));

    doneButton = new LinearLayout(context);
    doneButton.setOrientation(LinearLayout.HORIZONTAL);
    doneButton.setBackgroundDrawable(Theme.createBarSelectorDrawable(isDarkTheme ? Theme.ACTION_BAR_PICKER_SELECTOR_COLOR : Theme.ACTION_BAR_AUDIO_SELECTOR_COLOR, false));
    doneButton.setPadding(AndroidUtilities.dp(29), 0, AndroidUtilities.dp(29), 0);
    addView(doneButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.RIGHT));

    doneButtonBadgeTextView = new TextView(context);
    doneButtonBadgeTextView.setTypeface(FontManager.instance().getTypeface());
    doneButtonBadgeTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    doneButtonBadgeTextView.setTextColor(0xffffffff);
    doneButtonBadgeTextView.setGravity(Gravity.CENTER);
    doneButtonBadgeTextView.setBackgroundResource(isDarkTheme ? R.drawable.photobadge : R.drawable.bluecounter);
    doneButtonBadgeTextView.setMinWidth(AndroidUtilities.dp(23));
    doneButtonBadgeTextView.setPadding(AndroidUtilities.dp(8), 0, AndroidUtilities.dp(8), AndroidUtilities.dp(1));
    doneButton.addView(doneButtonBadgeTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, 23, Gravity.CENTER_VERTICAL, 0, 0, 10, 0));

    doneButtonTextView = new TextView(context);
    doneButtonTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    doneButtonTextView.setTextColor(isDarkTheme ? 0xffffffff : 0xff19a7e8);
    doneButtonTextView.setGravity(Gravity.CENTER);
    doneButtonTextView.setCompoundDrawablePadding(AndroidUtilities.dp(8));
    doneButtonTextView.setText(LocaleController.getString("Send", R.string.Send).toUpperCase());
    doneButtonTextView.setTypeface(FontManager.instance().getTypeface());
    doneButton.addView(doneButtonTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL));
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:42,代码来源:PickerBottomLayout.java

示例12: PickerBottomLayout

import android.widget.LinearLayout; //导入方法依赖的package包/类
public PickerBottomLayout(Context context, boolean darkTheme) {
    super(context);
    isDarkTheme = darkTheme;

    setBackgroundColor(isDarkTheme ? 0xff1a1a1a : 0xffffffff);

    cancelButton = new TextView(context);
    cancelButton.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
    cancelButton.setTextColor(isDarkTheme ? 0xffffffff : 0xff007aff);
    cancelButton.setGravity(Gravity.CENTER);
    cancelButton.setBackgroundDrawable(
            Theme.createBarSelectorDrawable(isDarkTheme ? Theme.ACTION_BAR_PICKER_SELECTOR_COLOR
                    : Theme.ACTION_BAR_AUDIO_SELECTOR_COLOR, false));
    cancelButton.setPadding(AndroidUtilities.dp(29), 0, AndroidUtilities.dp(29), 0);
    cancelButton.setText(R.string.Preview);
    // cancelButton.getPaint().setFakeBoldText(true);
    addView(cancelButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT,
            LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));

    doneButton = new LinearLayout(context);
    doneButton.setOrientation(LinearLayout.HORIZONTAL);
    doneButton.setBackgroundDrawable(
            Theme.createBarSelectorDrawable(isDarkTheme ? Theme.ACTION_BAR_PICKER_SELECTOR_COLOR
                    : Theme.ACTION_BAR_AUDIO_SELECTOR_COLOR, false));
    doneButton.setPadding(AndroidUtilities.dp(29), 0, AndroidUtilities.dp(29), 0);
    addView(doneButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT,
            LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.RIGHT));

    doneButtonBadgeTextView = new TextView(context);
    // doneButtonBadgeTextView.getPaint().setFakeBoldText(true);
    doneButtonBadgeTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
    doneButtonBadgeTextView.setTextColor(0xffffffff);
    doneButtonBadgeTextView.setGravity(Gravity.CENTER);
    doneButtonBadgeTextView.setBackgroundResource(
            isDarkTheme ? R.drawable.photobadge_new : R.drawable.photobadge_new);
    doneButtonBadgeTextView.setPadding(AndroidUtilities.dp(8), 0, AndroidUtilities.dp(8),
            AndroidUtilities.dp(1));
    doneButton.addView(doneButtonBadgeTextView,
            LayoutHelper.createLinear(26, 26, Gravity.CENTER_VERTICAL, 0, 0, 10, 0));

    doneButtonTextView = new TextView(context);
    doneButtonTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
    doneButtonTextView.setTextColor(isDarkTheme ? 0xffffffff : 0xff007aff);
    doneButtonTextView.setGravity(Gravity.CENTER);
    doneButtonTextView.setCompoundDrawablePadding(AndroidUtilities.dp(8));
    doneButtonTextView.setText(R.string.Send);
    // doneButtonTextView.getPaint().setFakeBoldText(true);
    doneButton.addView(doneButtonTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT,
            LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL));
}
 
开发者ID:chengzichen,项目名称:KrGallery,代码行数:51,代码来源:PickerBottomLayout.java

示例13: PickerBottomLayout

import android.widget.LinearLayout; //导入方法依赖的package包/类
public PickerBottomLayout(Context context, boolean darkTheme) {
    super(context);
    isDarkTheme = darkTheme;

    setBackgroundColor(isDarkTheme ? 0xff1a1a1a : 0xffffffff);

    cancelButton = new TextView(context);
    cancelButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    cancelButton.setTextColor(isDarkTheme ? 0xffffffff : 0xff19a7e8);
    cancelButton.setGravity(Gravity.CENTER);
    cancelButton.setBackgroundDrawable(Theme.createBarSelectorDrawable(isDarkTheme ? Theme.ACTION_BAR_PICKER_SELECTOR_COLOR : Theme.ACTION_BAR_AUDIO_SELECTOR_COLOR, false));
    cancelButton.setPadding(AndroidUtilities.dp(29), 0, AndroidUtilities.dp(29), 0);
    cancelButton.setText(LocaleController.getString("Cancel", R.string.Cancel).toUpperCase());
    cancelButton.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    addView(cancelButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));

    doneButton = new LinearLayout(context);
    doneButton.setOrientation(LinearLayout.HORIZONTAL);
    doneButton.setBackgroundDrawable(Theme.createBarSelectorDrawable(isDarkTheme ? Theme.ACTION_BAR_PICKER_SELECTOR_COLOR : Theme.ACTION_BAR_AUDIO_SELECTOR_COLOR, false));
    doneButton.setPadding(AndroidUtilities.dp(29), 0, AndroidUtilities.dp(29), 0);
    addView(doneButton, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.RIGHT));

    doneButtonBadgeTextView = new TextView(context);
    doneButtonBadgeTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    doneButtonBadgeTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    doneButtonBadgeTextView.setTextColor(0xffffffff);
    doneButtonBadgeTextView.setGravity(Gravity.CENTER);
    doneButtonBadgeTextView.setBackgroundResource(isDarkTheme ? R.drawable.photobadge : R.drawable.bluecounter);
    doneButtonBadgeTextView.setMinWidth(AndroidUtilities.dp(23));
    doneButtonBadgeTextView.setPadding(AndroidUtilities.dp(8), 0, AndroidUtilities.dp(8), AndroidUtilities.dp(1));
    doneButton.addView(doneButtonBadgeTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, 23, Gravity.CENTER_VERTICAL, 0, 0, 10, 0));

    doneButtonTextView = new TextView(context);
    doneButtonTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    doneButtonTextView.setTextColor(isDarkTheme ? 0xffffffff : 0xff19a7e8);
    doneButtonTextView.setGravity(Gravity.CENTER);
    doneButtonTextView.setCompoundDrawablePadding(AndroidUtilities.dp(8));
    doneButtonTextView.setText(LocaleController.getString("Send", R.string.Send).toUpperCase());
    doneButtonTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    doneButton.addView(doneButtonTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL));
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:42,代码来源:PickerBottomLayout.java


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