use of android.widget.TextView in project mosby by sockeqwe.
the class TextSizeTransition method captureValues.
private void captureValues(TransitionValues transitionValues) {
if (transitionValues.view instanceof TextView) {
TextView textView = (TextView) transitionValues.view;
transitionValues.values.put(PROPNAME_TEXT_SIZE, textView.getTextSize());
}
}
use of android.widget.TextView in project mosby by sockeqwe.
the class SecondBackstackMviLifecycleFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_mvi, container, false);
TextView tv = (TextView) view.findViewById(R.id.text);
tv.setText(getClass().getSimpleName());
return view;
}
use of android.widget.TextView in project TextJustify-Android by bluejamesbond.
the class TestActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(getContentView());
testName = Utils.splitCamelCase(getClass().getSimpleName());
TextView titleBar = ((TextView) findViewById(R.id.titlebar));
if (titleBar != null) {
titleBar.setText(testName);
}
}
use of android.widget.TextView in project TextJustify-Android by bluejamesbond.
the class TestList method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Set default app font
// FontsOverride.setDefaultFont(this, "DEFAULT", "fonts/notosans.ttf");
// Set layout
setContentView(R.layout.testlist_activity);
// Create list of simple test names
String[] testNames = new String[tests.length];
for (int i = 0; i < testNames.length; i++) {
testNames[i] = Utils.splitCamelCase(tests[i].getSimpleName()).toUpperCase();
}
// Get listView
ListView lv = (ListView) findViewById(R.id.list);
// Assign adapter to List
lv.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, testNames) {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = super.getView(position, convertView, parent);
TextView textView = (TextView) view.findViewById(android.R.id.text1);
textView.setTypeface(Typeface.DEFAULT_BOLD);
textView.setBackgroundColor(Color.parseColor("#111111"));
textView.setTextColor(Color.WHITE);
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
return view;
}
});
// For each click
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
startActivity(new Intent(TestList.this, tests[i]));
}
});
}
use of android.widget.TextView in project BGABanner-Android by bingoogolapple.
the class BGABanner method initView.
private void initView(Context context) {
RelativeLayout pointContainerRl = new RelativeLayout(context);
if (Build.VERSION.SDK_INT >= 16) {
pointContainerRl.setBackground(mPointContainerBackgroundDrawable);
} else {
pointContainerRl.setBackgroundDrawable(mPointContainerBackgroundDrawable);
}
pointContainerRl.setPadding(mPointContainerLeftRightPadding, mPointTopBottomMargin, mPointContainerLeftRightPadding, mPointTopBottomMargin);
RelativeLayout.LayoutParams pointContainerLp = new RelativeLayout.LayoutParams(RMP, RWC);
// 处理圆点在顶部还是底部
if ((mPointGravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.TOP) {
pointContainerLp.addRule(RelativeLayout.ALIGN_PARENT_TOP);
} else {
pointContainerLp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
}
addView(pointContainerRl, pointContainerLp);
RelativeLayout.LayoutParams indicatorLp = new RelativeLayout.LayoutParams(RWC, RWC);
indicatorLp.addRule(CENTER_VERTICAL);
if (mIsNumberIndicator) {
mNumberIndicatorTv = new TextView(context);
mNumberIndicatorTv.setId(R.id.banner_indicatorId);
mNumberIndicatorTv.setGravity(Gravity.CENTER_VERTICAL);
mNumberIndicatorTv.setSingleLine(true);
mNumberIndicatorTv.setEllipsize(TextUtils.TruncateAt.END);
mNumberIndicatorTv.setTextColor(mNumberIndicatorTextColor);
mNumberIndicatorTv.setTextSize(TypedValue.COMPLEX_UNIT_PX, mNumberIndicatorTextSize);
mNumberIndicatorTv.setVisibility(View.INVISIBLE);
if (mNumberIndicatorBackground != null) {
if (Build.VERSION.SDK_INT >= 16) {
mNumberIndicatorTv.setBackground(mNumberIndicatorBackground);
} else {
mNumberIndicatorTv.setBackgroundDrawable(mNumberIndicatorBackground);
}
}
pointContainerRl.addView(mNumberIndicatorTv, indicatorLp);
} else {
mPointRealContainerLl = new LinearLayout(context);
mPointRealContainerLl.setId(R.id.banner_indicatorId);
mPointRealContainerLl.setOrientation(LinearLayout.HORIZONTAL);
mPointRealContainerLl.setGravity(Gravity.CENTER_VERTICAL);
pointContainerRl.addView(mPointRealContainerLl, indicatorLp);
}
RelativeLayout.LayoutParams tipLp = new RelativeLayout.LayoutParams(RMP, RWC);
tipLp.addRule(CENTER_VERTICAL);
mTipTv = new TextView(context);
mTipTv.setGravity(Gravity.CENTER_VERTICAL);
mTipTv.setSingleLine(true);
mTipTv.setEllipsize(TextUtils.TruncateAt.END);
mTipTv.setTextColor(mTipTextColor);
mTipTv.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTipTextSize);
pointContainerRl.addView(mTipTv, tipLp);
int horizontalGravity = mPointGravity & Gravity.HORIZONTAL_GRAVITY_MASK;
// 处理圆点在左边、右边还是水平居中
if (horizontalGravity == Gravity.LEFT) {
indicatorLp.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
tipLp.addRule(RelativeLayout.RIGHT_OF, R.id.banner_indicatorId);
mTipTv.setGravity(Gravity.CENTER_VERTICAL | Gravity.RIGHT);
} else if (horizontalGravity == Gravity.RIGHT) {
indicatorLp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
tipLp.addRule(RelativeLayout.LEFT_OF, R.id.banner_indicatorId);
} else {
indicatorLp.addRule(RelativeLayout.CENTER_HORIZONTAL);
tipLp.addRule(RelativeLayout.LEFT_OF, R.id.banner_indicatorId);
}
showPlaceholder();
}
Aggregations