本文整理汇总了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;
}