本文整理匯總了Java中android.widget.TextView.getTextColors方法的典型用法代碼示例。如果您正苦於以下問題:Java TextView.getTextColors方法的具體用法?Java TextView.getTextColors怎麽用?Java TextView.getTextColors使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.TextView
的用法示例。
在下文中一共展示了TextView.getTextColors方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onSharedElementStart
import android.widget.TextView; //導入方法依賴的package包/類
@Override
public void onSharedElementStart(List<String> sharedElementNames,
List<View> sharedElements,
List<View> sharedElementSnapshots) {
TextView author = getAuthor();
targetTextSize = author.getTextSize();
targetTextColors = author.getTextColors();
targetPadding = new Rect(author.getPaddingLeft(),
author.getPaddingTop(),
author.getPaddingRight(),
author.getPaddingBottom());
if (IntentUtil.hasAll(intent,
IntentUtil.TEXT_COLOR, IntentUtil.FONT_SIZE, IntentUtil.PADDING)) {
author.setTextColor(intent.getIntExtra(IntentUtil.TEXT_COLOR, Color.BLACK));
float textSize = intent.getFloatExtra(IntentUtil.FONT_SIZE, targetTextSize);
author.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
Rect padding = intent.getParcelableExtra(IntentUtil.PADDING);
author.setPadding(padding.left, padding.top, padding.right, padding.bottom);
}
}
示例2: init
import android.widget.TextView; //導入方法依賴的package包/類
private void init() {
mSolidColor = 0;
mSelectionDivider = getResources().getDrawable(R.drawable.numberpicker_selection_divider);
mSelectionDividerHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, UNSCALED_DEFAULT_SELECTION_DIVIDER_HEIGHT, getResources().getDisplayMetrics());
mSelectionDividersDistance = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, UNSCALED_DEFAULT_SELECTION_DIVIDERS_DISTANCE, getResources().getDisplayMetrics());
mMinHeight = SIZE_UNSPECIFIED;
mMaxHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 180, getResources().getDisplayMetrics());
if (mMinHeight != SIZE_UNSPECIFIED && mMaxHeight != SIZE_UNSPECIFIED && mMinHeight > mMaxHeight) {
throw new IllegalArgumentException("minHeight > maxHeight");
}
mMinWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 64, getResources().getDisplayMetrics());
mMaxWidth = SIZE_UNSPECIFIED;
if (mMinWidth != SIZE_UNSPECIFIED && mMaxWidth != SIZE_UNSPECIFIED && mMinWidth > mMaxWidth) {
throw new IllegalArgumentException("minWidth > maxWidth");
}
mComputeMaxWidth = (mMaxWidth == SIZE_UNSPECIFIED);
mVirtualButtonPressedDrawable = getResources().getDrawable(R.drawable.item_background_holo_light);
mPressedStateHelper = new PressedStateHelper();
setWillNotDraw(false);
mInputText = new TextView(getContext());
addView(mInputText);
mInputText.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
mInputText.setGravity(Gravity.CENTER);
mInputText.setSingleLine(true);
mInputText.setBackgroundResource(0);
mInputText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
ViewConfiguration configuration = ViewConfiguration.get(getContext());
mTouchSlop = configuration.getScaledTouchSlop();
mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity();
mMaximumFlingVelocity = configuration.getScaledMaximumFlingVelocity() / SELECTOR_MAX_FLING_VELOCITY_ADJUSTMENT;
mTextSize = (int) mInputText.getTextSize();
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setTextAlign(Align.CENTER);
paint.setTextSize(mTextSize);
paint.setTypeface(mInputText.getTypeface());
ColorStateList colors = mInputText.getTextColors();
int color = colors.getColorForState(ENABLED_STATE_SET, Color.WHITE);
paint.setColor(color);
mSelectorWheelPaint = paint;
mFlingScroller = new Scroller(getContext(), null, true);
mAdjustScroller = new Scroller(getContext(), new DecelerateInterpolator(2.5f));
updateInputTextView();
}
示例3: init
import android.widget.TextView; //導入方法依賴的package包/類
private void init() {
mSolidColor = 0;
mSelectionDivider = getResources().getDrawable(R.drawable.numberpicker_selection_divider);
mSelectionDividerHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, UNSCALED_DEFAULT_SELECTION_DIVIDER_HEIGHT, getResources().getDisplayMetrics());
mSelectionDividersDistance = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, UNSCALED_DEFAULT_SELECTION_DIVIDERS_DISTANCE, getResources().getDisplayMetrics());
mMinHeight = SIZE_UNSPECIFIED;
mMaxHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 180, getResources().getDisplayMetrics());
if (mMinHeight != SIZE_UNSPECIFIED && mMaxHeight != SIZE_UNSPECIFIED && mMinHeight > mMaxHeight) {
throw new IllegalArgumentException("minHeight > maxHeight");
}
mMinWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 64, getResources().getDisplayMetrics());
mMaxWidth = SIZE_UNSPECIFIED;
if (mMinWidth != SIZE_UNSPECIFIED && mMaxWidth != SIZE_UNSPECIFIED && mMinWidth > mMaxWidth) {
throw new IllegalArgumentException("minWidth > maxWidth");
}
mComputeMaxWidth = (mMaxWidth == SIZE_UNSPECIFIED);
mVirtualButtonPressedDrawable = getResources().getDrawable(R.drawable.item_background_holo_light);
mPressedStateHelper = new PressedStateHelper();
setWillNotDraw(false);
mInputText = new TextView(getContext());
addView(mInputText);
mInputText.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
mInputText.setGravity(Gravity.CENTER);
mInputText.setSingleLine(true);
mInputText.setBackgroundResource(0);
mInputText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
ViewConfiguration configuration = ViewConfiguration.get(getContext());
mTouchSlop = configuration.getScaledTouchSlop();
mMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity();
mMaximumFlingVelocity = configuration.getScaledMaximumFlingVelocity() / SELECTOR_MAX_FLING_VELOCITY_ADJUSTMENT;
mTextSize = (int) mInputText.getTextSize();
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setTextAlign(Align.CENTER);
paint.setTextSize(mTextSize);
paint.setTypeface(mInputText.getTypeface());
ColorStateList colors = mInputText.getTextColors();
int color = colors.getColorForState(ENABLED_STATE_SET, Color.WHITE);
paint.setColor(color);
mSelectorWheelPaint = paint;
mFlingScroller = new Scroller(getContext(), null, true);
mAdjustScroller = new Scroller(getContext(), new DecelerateInterpolator(2.5f));
updateInputTextView();
}
示例4: onCreate
import android.widget.TextView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_summary);
overridePendingTransition(R.anim.pull_in_right, R.anim.push_out_left);
summaryTextView = (TextView) findViewById(R.id.summary_text_view);
summaryTextViewDefaultColor = summaryTextView.getTextColors();
locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
contactsLinearLayout = (LinearLayout) findViewById(R.id.contacts_linear_layout);
shutdownButton = (FloatingActionButton) findViewById(R.id.shutdown_button);
shutdownButton.setOnClickListener(this);
int flags = WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
| WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
| WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
getWindow().addFlags(flags);
// TODO: Sostituisci con BitmapDescriptorFactory.fromResource(R.drawable.ic_message) quando https://code.google.com/p/gmaps-api-issues/issues/detail?id=9011 sarà corretto
Drawable vectorDrawable = ContextCompat.getDrawable(this, R.drawable.ic_message);
int w = vectorDrawable.getIntrinsicWidth();
int h = vectorDrawable.getIntrinsicHeight();
vectorDrawable.setBounds(0, 0, w, h);
Bitmap bm = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bm);
vectorDrawable.draw(canvas);
mapMarkerBitmapDescriptor = BitmapDescriptorFactory.fromBitmap(bm);
// :ODOT
MapFragment mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map_fragment);
mapFragment.getMapAsync(this);
smsUpdateReceiver = new SmsUpdateReceiver();
registerReceiver(smsUpdateReceiver, new IntentFilter("android.provider.Telephony.SMS_RECEIVED"));
sentSmsStatusReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
int contactIndex = intent.getIntExtra(CONTACT_INDEX_EXTRA, -1);
if (contactIndex < 0 || contactIndex >= favoriteContacts.size())
return;
boolean smsDelivered = intent.getAction().equals(SMS_STATUS_DELIVERED_ACTION);
RoundedContactBadge contactBadge = (RoundedContactBadge) contactsLinearLayout.getChildAt(contactIndex);
if (smsDelivered)
contactBadge.setContactStatus(RoundedContactBadge.ContactStatus.DELIVERED);
else {
boolean smsSent = getResultCode() == Activity.RESULT_OK;
contactBadge.setContactStatus(smsSent ? RoundedContactBadge.ContactStatus.SENT : RoundedContactBadge.ContactStatus.ERROR);
}
}
};
IntentFilter filter = new IntentFilter();
filter.addAction(SMS_STATUS_SENT_ACTION);
filter.addAction(SMS_STATUS_DELIVERED_ACTION);
registerReceiver(sentSmsStatusReceiver, filter);
loadContactsIfNeeded();
if (savedInstanceState == null)
alertAllContacts();
}
示例5: getHeaderColor
import android.widget.TextView; //導入方法依賴的package包/類
public ColorStateList getHeaderColor() {
final TextView titleView = getHeaderTextView();
return titleView != null ? titleView.getTextColors() : null;
}