android.widget.Button#setTextColor ( )源码实例Demo

下面列出了android.widget.Button#setTextColor ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: YTPlayer   文件: DownloadAdpater2.java
private void setButtonColor(Button v) {
    switch (v.getText().toString()) {
        case "mp3":
            v.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(v.getContext(),R.color.colorAccent)));
            break;

        case "m4a":
            v.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(v.getContext(),R.color.blue)));
            break;

        case "mp4":
            v.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(v.getContext(),R.color.playback_indicator)));
            v.setTextColor(ContextCompat.getColor(v.getContext(),R.color.background));
            break;
    }
}
 
源代码2 项目: heads-up   文件: HoloLight.java
@Override
public void addActionButton(ViewGroup actionButtons, String actionTitle, Drawable icon, View.OnClickListener clickListener, float fontMultiplier) {

    LayoutInflater inflater = LayoutInflater.from(actionButtons.getContext());
    ViewGroup v = (ViewGroup) inflater.inflate(
            R.layout.button_notification, actionButtons);

    Button button = (Button) v.getChildAt(v.getChildCount() - 1);
    button.setText(actionTitle);
    button.setTextSize(TypedValue.COMPLEX_UNIT_PX, fontMultiplier * button.getTextSize());
    button.setTextColor(Color.DKGRAY);
    if (icon != null) {
        icon.mutate().setColorFilter(Color.BLACK, PorterDuff.Mode.MULTIPLY);
        button.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null);
    }
    button.setOnClickListener(clickListener);
}
 
源代码3 项目: always-on-amoled   文件: Intro.java
@Override
public void onResume() {
    super.onResume();
    try {
        permissions[0] = true;
        go = (Button) v.findViewById(R.id.go);
        WindowManager.LayoutParams lp = new WindowManager.LayoutParams(-1, -1, 2003, 65794, -2);
        lp.type = WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;
        View view = new View(context);
        ((WindowManager) context.getSystemService(WINDOW_SERVICE)).addView(view, lp);
        ((WindowManager) context.getSystemService(WINDOW_SERVICE)).removeView(view);
        go.setVisibility(View.INVISIBLE);
    } catch (Exception e) {
        permissions[0] = false;
        go.setTextColor(context.getResources().getColor(android.R.color.black));
        go.setText(getString(R.string.intro_allow_now));
        go.setEnabled(true);
        v.findViewById(R.id.go).setOnClickListener(v1 -> {
            if (Utils.isAndroidNewerThanM()) {
                Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + context.getPackageName()));
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                startActivity(intent);
            }
        });
    }
}
 
源代码4 项目: KUtils-master   文件: ToolUtils.java
/**
 * 设置MD风格样式
 */
public static void setMdBtnStytle(BuildBean bean) {
    Button btnPositive =
            bean.alertDialog.getButton(AlertDialog.BUTTON_POSITIVE);
    Button btnNegative =
            bean.alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE);
    Button btnNatural =
            bean.alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL);
    if (btnPositive != null && btnNegative != null) {
        btnPositive.setTextSize(bean.btnTxtSize);
        btnNegative.setTextSize(bean.btnTxtSize);
        btnNatural.setTextSize(bean.btnTxtSize);
        if (bean.btn1Color != 0)
            btnPositive.setTextColor(getColor(null, bean.btn1Color));
        if (bean.btn2Color != 0)
            btnNegative.setTextColor(getColor(null, bean.btn2Color));
        if (bean.btn3Color != 0)
            btnNatural.setTextColor(getColor(null, bean.btn3Color));
    }
    Window window = bean.alertDialog.getWindow();
    window.setGravity(bean.gravity);
}
 
源代码5 项目: YiBo   文件: ThemeUtil.java
public static void setSecondaryMicroBlogHeader(View headerView) {
	if (headerView == null) {
		return;
	}
	Theme theme = ThemeUtil.createTheme(headerView.getContext());
	LinearLayout llHeaderBase = (LinearLayout)headerView.findViewById(R.id.llHeaderBase);
	Button btnBack = (Button)headerView.findViewById(R.id.btnBack);
	Button btnPrevious = (Button)headerView.findViewById(R.id.btnPrevious);
	Button btnNext = (Button)headerView.findViewById(R.id.btnNext);
	Button btnOperate = (Button) headerView.findViewById(R.id.btnOperate);
	TextView tvTitle = (TextView) headerView.findViewById(R.id.tvTitle);
	
	llHeaderBase.setBackgroundDrawable(theme.getDrawable("bg_header"));
	llHeaderBase.setGravity(Gravity.CENTER);
	int padding8 = theme.dip2px(8);
	llHeaderBase.setPadding(padding8, 0, padding8, 0);
	btnBack.setBackgroundDrawable(theme.getDrawable("selector_btn_action_back"));
	btnBack.setTextColor(theme.getColorStateList("selector_btn_header_action"));
	tvTitle.setTextColor(theme.getColorStateList("selector_header_title"));
	btnPrevious.setBackgroundDrawable(theme.getDrawable("selector_btn_action_previous"));
	btnNext.setBackgroundDrawable(theme.getDrawable("selector_btn_action_next"));
	btnOperate.setBackgroundDrawable(theme.getDrawable("selector_btn_action_additional"));
	int padding12 = theme.dip2px(12);
	btnOperate.setPadding(padding12, 0, padding12, 0);
	btnOperate.setTextColor(theme.getColor("selector_btn_header_action"));
}
 
源代码6 项目: Mysplash   文件: NotificationHelper.java
public static void showActionSnackbar(@NonNull MysplashActivity activity,
                                      String content, String action, View.OnClickListener l) {
    View container = activity.provideSnackbarContainer();
    if (container != null) {
        Snackbar snackbar = Snackbar
                .make(container, content, Snackbar.LENGTH_LONG)
                .setAction(action, l);

        Snackbar.SnackbarLayout snackbarLayout = (Snackbar.SnackbarLayout) snackbar.getView();
        snackbarLayout.setBackgroundColor(ThemeManager.getRootColor(activity));

        TextView contentTxt = snackbarLayout.findViewById(R.id.snackbar_text);
        contentTxt.setTextColor(ThemeManager.getContentColor(activity));

        Button actionBtn = snackbarLayout.findViewById(R.id.snackbar_action);
        actionBtn.setTextColor(ThemeManager.getTitleColor(activity));

        snackbar.show();
    }
}
 
/**
 * Format the button
 * @param button The button
 * @param active Active
 */
public void setButtonActive(Button button, boolean active) {
    int colorText;
    int colorBackground;

    // Button is active
    if (active) {
        // Gets the active color

        colorText = ContextCompat.getColor(getContext(), R.color.button_navigation_drawer_text_active);
        colorBackground = ContextCompat.getColor(getContext(), R.color.button_navigation_drawer_active);
    } else {
        // Gets the normal color
        colorText = ContextCompat.getColor(getContext(), R.color.button_navigation_drawer_text);
        colorBackground = ContextCompat.getColor(getContext(), R.color.button_navigation_drawer_normal);
    }

    // Sets the color
    button.setBackgroundColor(colorBackground);
    button.setTextColor(colorText);
    button.getCompoundDrawables()[0].setColorFilter(colorText, PorterDuff.Mode.MULTIPLY);
}
 
源代码8 项目: PinLock   文件: KeypadAdapter.java
/**
 * Setting Button background styles such as background, size and shape
 * @param view Button itself
 */
private void setStyle(Button view) {
    final int textSize = styledAttributes.getInt(R.styleable.PinLock_keypadTextSize, 12);
    view.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize);

    final int color = styledAttributes.getColor(R.styleable.PinLock_keypadTextColor, Color.BLACK);
    view.setTextColor(color);

    final int background = styledAttributes
            .getResourceId(R.styleable.PinLock_keypadButtonShape, R.drawable.rectangle);
    view.setBackgroundResource(background);
}
 
源代码9 项目: androiddevice.info   文件: MainActivity.java
private synchronized void submit() {
    LinearLayout alertLayout = (LinearLayout)LayoutInflater.from(MainActivity.this).inflate(R.layout.sending_alert,null);
    AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
    builder.setCancelable(false).setView(alertLayout).setNegativeButton(android.R.string.ok, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });
    mAlertDialog = builder.show();
    //Button isn't null after show
    Button button = mAlertDialog.getButton(AlertDialog.BUTTON_NEGATIVE);
    button.setBackgroundResource(R.drawable.black_background_state);
    button.setTextColor(MainActivity.this.getResources().getColor(android.R.color.white));

    if(hasBeenSubmitted()) {
        ((TextView)mAlertDialog.findViewById(android.R.id.text1)).setText(R.string.alreadySent);
        mAlertDialog.findViewById(R.id.sending_progressbar).setVisibility(View.GONE);
        button.setEnabled(true);
    } else {
        button.setEnabled(false);

        final JSONObject deviceInformation = DeviceInformation.getInstance().getDeviceInformation();
        if(null != mDeviceName && 0 != mDeviceName.length()) {
            try {
                deviceInformation.put("name", mDeviceName);
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }

        RequestBody formBody = new FormEncodingBuilder().add("device", deviceInformation.toString()).build();
        Request request = new Request.Builder().url(getString(R.string.submit)).addHeader("User-Agent", "APP").post(formBody).build();
        client.newCall(request).enqueue(new HTTPCallback(this.getApplication()));
    }
}
 
private void initView() {
	cbSelect = (CheckBox) findViewById(R.id.cbSelect);
	tvSelect = (TextView) findViewById(R.id.tvSelect);
	btnNext = (Button) findViewById(R.id.btnNext);

	moudlechoose = (TextView) findViewById(R.id.moudlechoose);

	String mdchoose = getResources().getString(R.string.moudlechoose);

	String[] split = mdchoose.split("xx");

	int setModuleSelectOn = GosDeploy.setModuleSelectOn();

	if (setModuleSelectOn == 0) {
		moudlechoose.setVisibility(View.VISIBLE);
	} else {
		moudlechoose.setVisibility(View.INVISIBLE);
	}

	if (split.length > 1) {
		moudlechoose.setText(
				split[0] + " " + modeList.get(GosAirlinkChooseDeviceWorkWiFiActivity.modeNum) + " " + split[1]);
	} else {
		moudlechoose.setText(
				split[0] + " " + modeList.get(GosAirlinkChooseDeviceWorkWiFiActivity.modeNum) + " " );
	}

	/** 加载Gif */
	GifView gif = (GifView) findViewById(R.id.softreset);
	gif.setMovieResource(R.drawable.airlink);

	// 配置文件部署
	btnNext.setBackgroundDrawable(GosDeploy.setButtonBackgroundColor());
	btnNext.setTextColor(GosDeploy.setButtonTextColor());

}
 
源代码11 项目: Mysplash   文件: NotificationHelper.java
public static void showActionSnackbar(String content, String action,
                                      int duration, View.OnClickListener l) {
    if (Mysplash.getInstance().getActivityCount() > 0) {
        MysplashActivity a = Mysplash.getInstance().getTopActivity();
        View container = a.provideSnackbarContainer();

        Snackbar snackbar = Snackbar
                .make(container, content, duration)
                .setAction(action, l);

        Snackbar.SnackbarLayout snackbarLayout = (Snackbar.SnackbarLayout) snackbar.getView();

        TextView contentTxt = (TextView) snackbarLayout.findViewById(R.id.snackbar_text);
        DisplayUtils.setTypeface(a, contentTxt);

        Button actionBtn = (Button) snackbarLayout.findViewById(R.id.snackbar_action);

        if (Mysplash.getInstance().isLightTheme()) {
            contentTxt.setTextColor(ContextCompat.getColor(a, R.color.colorTextContent_light));
            actionBtn.setTextColor(ContextCompat.getColor(a, R.color.colorTextTitle_light));
            snackbarLayout.setBackgroundResource(R.color.colorRoot_light);
        } else {
            contentTxt.setTextColor(ContextCompat.getColor(a, R.color.colorTextContent_dark));
            actionBtn.setTextColor(ContextCompat.getColor(a, R.color.colorTextTitle_dark));
            snackbarLayout.setBackgroundResource(R.color.colorRoot_dark);
        }

        snackbar.show();
    }
}
 
源代码12 项目: zulip-android   文件: TopSnackBar.java
/**
 * Create And Add Layout
 */
private void createAndAddLayout() {
    CoordinatorLayout.LayoutParams layoutParams = new CoordinatorLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    linearLayout.setLayoutParams(layoutParams);
    linearLayout.setOrientation(LinearLayout.HORIZONTAL);
    linearLayout.setWeightSum(1f);
    linearLayout.setGravity(Gravity.CENTER_VERTICAL);

    LinearLayout.LayoutParams tvLayoutParams = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT);
    tvLayoutParams.weight = 0.7f;

    LinearLayout.LayoutParams showButtonLayoutParams = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT);
    showButtonLayoutParams.weight = 0.3f;

    tvText = new TextView(context);
    tvText.setLayoutParams(tvLayoutParams);
    tvText.setTextColor(ContextCompat.getColor(context, R.color.top_snackbar_text_color));
    tvText.setPadding(24, 0, 0, 0);
    linearLayout.addView(tvText);

    showButton = new Button(context);
    showButton.setBackgroundColor(ContextCompat.getColor(context, android.R.color.transparent));
    showButton.setTextColor(ContextCompat.getColor(context, R.color.top_snackbar_show_button_text_color));
    showButton.setGravity(Gravity.END | Gravity.CENTER_VERTICAL);
    showButton.setLayoutParams(showButtonLayoutParams);
    linearLayout.addView(showButton);

    linearLayout.setVisibility(View.GONE);
    linearLayout.setBackgroundResource(R.drawable.top_snackbar_bg);
}
 
源代码13 项目: placeholderj   文件: CustomizeViews.java
private void customizeViewError(ViewGroup viewError, ImageView viewErrorImage,
                                TextView viewErrorMessage, Button viewErrorTryAgainButton) {
    if (viewError != null) {
        if (mPlaceHolderManager.mViewErrorBackgroundColor != 0) {
            viewError.setBackgroundColor(getColor(mPlaceHolderManager.mViewErrorBackgroundColor));
        } else if (mPlaceHolderManager.mViewErrorBackgroundResource > 0) {
            viewError.setBackgroundResource(mPlaceHolderManager.mViewErrorBackgroundResource);
        }
        if (mPlaceHolderManager.mViewErrorText > 0) {
            viewErrorMessage.setText(mPlaceHolderManager.mViewErrorText);
        }
        if (mPlaceHolderManager.mViewErrorTextSize > 0) {
            setTextSize(viewErrorMessage, mPlaceHolderManager.mViewErrorTextSize);
        }
        if (mPlaceHolderManager.mViewErrorTextColor != 0) {
            viewErrorMessage.setTextColor(getColor(mPlaceHolderManager.mViewErrorTextColor));
        }
        if (mPlaceHolderManager.mViewErrorTryAgainButtonText > 0) {
            viewErrorTryAgainButton.setText(mPlaceHolderManager.mViewErrorTryAgainButtonText);
        }
        if (mPlaceHolderManager.mViewErrorTryAgainButtonTextColor > 0) {
            viewErrorTryAgainButton.setTextColor(mPlaceHolderManager.mViewErrorTryAgainButtonTextColor);
        }
        if (mPlaceHolderManager.mViewErrorTryAgainButtonBackgroundResource > 0) {
            int backgroundRes = mPlaceHolderManager.mViewErrorTryAgainButtonBackgroundResource;
            viewErrorTryAgainButton.setBackgroundResource(backgroundRes);
        }
        if (mPlaceHolderManager.mViewErrorImage > 0) {
            viewErrorImage.setImageDrawable(getDrawable(mPlaceHolderManager.mViewErrorImage));
        }
    }
}
 
@Override
public void onStart() {
    super.onStart();
    // Need to do this here, since getDialog() returns null in for example onBindDialogView()
    final Resources res = getContext().getResources();
    final Window window = getDialog().getWindow();
    Button button1 = window.findViewById(android.R.id.button1);
    Button button2 = window.findViewById(android.R.id.button2);
    button1.setTextColor(res.getColor(R.color.black));
    button2.setTextColor(res.getColor(R.color.black));
}
 
源代码15 项目: android_maplibui   文件: NGDialog.java
protected void setEnabled(Button button, boolean state) {
    button.setEnabled(state);
    button.setTextColor(state ? mEnabledColor : mDisabledColor);
}
 
源代码16 项目: dtube-mobile-unofficial   文件: MainActivity.java
@SuppressLint("InflateParams")
public void initFeed(){

    new Thread(() -> {
        videos = allVideos.getCategorizedVideos(selectedTab);

        class SortVideos implements Comparator<Video>
        {
            // Used for sorting in ascending order of
            // roll number
            public int compare(Video a, Video b)
            {
                return Long.compare(b.getDate(), a.getDate());
            }
        }

        if (selectedTab == DtubeAPI.CAT_SUBSCRIBED || selectedTab == DtubeAPI.CAT_NEW) {
            synchronized (videos) {
                Collections.sort(videos, new SortVideos());
            }
        }

        Log.d("dtube","UI: initFeed " + videos.size());

        MainActivity.this.runOnUiThread(() -> {
            feedAdapter.setVideos(videos);
            feedAdapter.notifyDataSetChanged();
            if (videos.size()>0)
            Log.d("dtube4","added vids ending with "+videos.get(videos.size()-1).title);
        });
    }).start();

    //Show button to login if user clicked on subscription feed and not logged in
    if (selectedTab == DtubeAPI.CAT_SUBSCRIBED) {
        if (accountInfo == null) {
            if (findViewById(R.id.login_for_subs) == null) {
                FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
                lp.gravity = Gravity.CENTER;
                Button v = (Button)LayoutInflater.from(this).inflate(R.layout.login_for_subs_btn, null);
                if (Preferences.darkMode)
                    v.setTextColor(Color.WHITE);
                v.setOnClickListener(view -> loginButtonClicked(null));
                mainFrame.addView(v, lp);
                recyclerView.setFocusable(false);
            }
        }else if (findViewById(R.id.login_for_subs) != null) {
            mainFrame.removeView(findViewById(R.id.login_for_subs));
            recyclerView.setFocusable(true);
        }
    }else if (findViewById(R.id.login_for_subs) != null) {
        mainFrame.removeView(findViewById(R.id.login_for_subs));
        recyclerView.setFocusable(true);
    }

    gettingMoreVideos = false;
    updateBottomBar();
}
 
源代码17 项目: PocketMaps   文件: GeocodeActivity.java
private OnClickListener createAddAddrClickListener(final GeoPoint loc, final EditType type,
                                          final EditText eaddr[], final TextView eaddrV[],
                                          final Button okButton, final String oldLocName)
{
  OnClickListener l = new OnClickListener()
  {
    @Override
    public void onClick(View v)
    {
      if (okButton.getCurrentTextColor() == Color.BLUE)
      { // ViewEdit --> Switch to edit!
        okButton.setTextColor(Color.BLACK);
        okButton.setText(R.string.ok);
        fillText(eaddr, null, View.VISIBLE);
        fillText(eaddrV, null, View.GONE);
        return;
      }
      new AsyncTask<Void, Void, Void>()
      {
        @Override
        protected Void doInBackground(Void... params)
        {
          Address addr = new Address(Locale.getDefault());
          for (int i=0; i<eaddr.length; i++)
          {
            String line = eaddr[i].getText().toString();
            if (i == (eaddr.length-1) &&
                     (!line.isEmpty()) &&
                     (!line.contains("\n")))
            { // Force MultiLine!
              line = line + "\n";
            }
            addr.setAddressLine(i, line);
          }
          GeoPoint newLoc = loc;
          if (type == EditType.EditOnly)
          {
            newLoc = getLocFromSpinner(locSpinner);
          }
          addr.setLatitude(newLoc.getLatitude());
          addr.setLongitude(newLoc.getLongitude());
          AddressLoc.addToProp(favourites, addr, oldLocName);
          String mapDir = Variable.getVariable().getMapsFolder().getParent();
          String propFile = new File(mapDir,FAV_PROP_FILE).getPath();
          try(FileOutputStream fos = new FileOutputStream(propFile))
          {
            favourites.store(fos, "List of favourites");
          }
          catch (IOException e)
          {
            logUser("Unable to store favourites");
          }
          return null;
        }
      }.execute();
      GeocodeActivity.this.finish();
    }
  };
  return l;
}
 
源代码18 项目: Patio   文件: Patio.java
/**
 * Custom methods
 */
public void init(Context context, AttributeSet attributeSet) {
    //Setup defaults
    mContext = context;
    mMaxPictures = DEFAULT_MAX_PICTURES;
    mThumbnailHeight = mContext.getResources().getDimension(R.dimen.patio_default_thumbnail_height);
    mThumbnailWidth = mContext.getResources().getDimension(R.dimen.patio_default_thumbnail_width);
    mThumbnailsMessageString = mContext.getResources().getString(R.string.patio_thumbnails_message);
    mPatioThumbnails = new ArrayList<PatioThumbnail>();
    setOrientation(VERTICAL);

    //Local defaults
    float thumbnailsContainerPadding = mContext.getResources().getDimension(R.dimen.patio_default_thumbnails_container_padding);
    int actionsTextColor = mContext.getResources().getColor(R.color.patio_default_action_text_color);
    int thumbnailsWrapperBackground = mContext.getResources().getColor(R.color.patio_default_thumbnails_container_background);


    //Inflate view and setup controls
    LayoutInflater inflater = LayoutInflater.from(context);
    inflater.inflate(WIDGET_LAYOUT_RES_ID, this, true);
    //Buttons
    mTakePicture = (Button) findViewById(R.id.patio_action_take_picture);
    mAttachPicture = (Button) findViewById(R.id.patio_action_attach_picture);
    mRemovePicture = (Button) findViewById(R.id.patio_action_remove_picture);
    mCancel = (Button) findViewById(R.id.patio_action_cancel);
    //Containers
    mThumbnailsWrapper = (HorizontalScrollView) findViewById(R.id.patio_thumbnails_wrapper);
    mThumbnailsContainer = (LinearLayout) findViewById(R.id.patio_thumbnails_container);
    mThumbnailsCount = (TextView) findViewById(R.id.patio_thumbnails_count_message);
    //Toolbars
    mToolbarAddActions = (LinearLayout) findViewById(R.id.patio_add_actions_toolbar);
    mToolbarRemoveActions = (LinearLayout) findViewById(R.id.patio_remove_actions_toolbar);
    mToolbarRemoveActions.setVisibility(View.GONE);

    //Set actions listeners
    if(!isInEditMode()) {
        mTakePicture.setOnClickListener(this);
        mAttachPicture.setOnClickListener(this);
        mRemovePicture.setOnClickListener(this);
        mCancel.setOnClickListener(this);
    }

    //Get defined attributes
    if(attributeSet != null) {
        TypedArray a = mContext.getTheme().obtainStyledAttributes(attributeSet, R.styleable.Patio, 0, 0);
        try {
            //Runtime
            mMaxPictures = a.getInt(R.styleable.Patio_maxPictures, DEFAULT_MAX_PICTURES);
            mThumbnailHeight = a.getDimension(R.styleable.Patio_thumbnailHeight, mThumbnailHeight);
            mThumbnailWidth = a.getDimension(R.styleable.Patio_thumbnailWidth, mThumbnailWidth);
            mThumbnailsMessageString = a.getString(R.styleable.Patio_thumbnailsMessage);
            //Local
            thumbnailsContainerPadding = a.getDimension(R.styleable.Patio_thumbnailsContainerPadding, thumbnailsContainerPadding);
            actionsTextColor = a.getColor(R.styleable.Patio_actionsTextColor, actionsTextColor);
            thumbnailsWrapperBackground = a.getColor(R.styleable.Patio_thumbnailsContainerBackground, thumbnailsWrapperBackground);
        } finally {
            a.recycle();
        }
    }

    //Check Max Pictures
    if(mMaxPictures <= 0) {
        mMaxPictures = DEFAULT_MAX_PICTURES;
    }

    //Check Thumbnail Message
    if(mThumbnailsMessageString == null) {
        mThumbnailsMessageString = mContext.getResources().getString(R.string.patio_thumbnails_message);
    }

    //Setup actions text color
    mTakePicture.setTextColor(actionsTextColor);
    mAttachPicture.setTextColor(actionsTextColor);
    mRemovePicture.setTextColor(actionsTextColor);
    mCancel.setTextColor(actionsTextColor);

    //Setup thumbnails container background
    mThumbnailsWrapper.setBackgroundColor(thumbnailsWrapperBackground);

    //Setup dimensions
    ViewGroup.LayoutParams layoutParams;
    int paddingTop, paddingBottom, paddingLeft, paddingRight;
    //Thumbnails Wrapper height
    layoutParams = mThumbnailsWrapper.getLayoutParams();
    layoutParams.height = Float.valueOf(mThumbnailHeight).intValue();
    mThumbnailsWrapper.setLayoutParams(layoutParams);
    //Thumbnails Container padding
    paddingTop = paddingBottom = paddingLeft = paddingRight = Float.valueOf(thumbnailsContainerPadding).intValue();
    mThumbnailsContainer.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom);

    //Init Thumbnails Message
    updateThumbnailsMessage();
}
 
源代码19 项目: androiddevice.info   文件: MainActivity.java
private void buttonStyleHelper(Button b){
    b.setBackgroundResource(R.drawable.black_background_state);
    b.setTextColor(getResources().getColor(android.R.color.white));
}
 
源代码20 项目: Liz   文件: ThemeHelper.java
public void themeButton(Button btn){
       if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
		btn.setTextColor(getTextColor());
		btn.setBackgroundColor(getButtonBackgroundColor());
	}
}