本文整理了Java中android.widget.TextView.setHorizontallyScrolling()
方法的一些代码示例,展示了TextView.setHorizontallyScrolling()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextView.setHorizontallyScrolling()
方法的具体详情如下:
包路径:android.widget.TextView
类名称:TextView
方法名:setHorizontallyScrolling
暂无
代码示例来源:origin: stackoverflow.com
TextView tv = (TextView)findViewById(R.id.editText);
if (tv != null) {
tv.setHorizontallyScrolling(false);
tv.setLines(3);
}
代码示例来源:origin: rey5137/material
v.setHorizontallyScrolling(a.getBoolean(attr, false));
代码示例来源:origin: cSploit/android
mSniffToggleButton = (ToggleButton) findViewById(R.id.sniffToggleButton);
mSniffProgress = (ProgressBar) findViewById(R.id.sniffActivity);
mTextDnsList.setHorizontallyScrolling(true);
代码示例来源:origin: willowtreeapps/Hyperion-Android
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.hc_activity);
report = (Report) getIntent().getSerializableExtra(EXTRA_REPORT);
final FloatingActionButton fab = findViewById(R.id.fab);
final TextView headerText = findViewById(R.id.header);
final TextView stacktraceText = findViewById(R.id.stacktrace);
final View container = findViewById(R.id.container);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final Intent intent = new Intent(Intent.ACTION_SEND);
final String text = getExternalText();
intent.putExtra(Intent.EXTRA_TEXT, text);
intent.setType("text/plain");
startActivity(Intent.createChooser(intent, "Share"));
}
});
stacktraceText.setHorizontallyScrolling(true);
stacktraceText.setMovementMethod(new ScrollingMovementMethod());
headerText.setText(report.header);
stacktraceText.setText(report.trace);
container.setOnClickListener(this);
}
代码示例来源:origin: Ronak-LM/memoir
private void updateSpinnerTitle(TextView titleView) {
if (titleView != null) {
titleView.setText(mSpinnerTitle);
titleView.setVisibility((mSpinnerTitle == null) ? View.GONE : View.VISIBLE);
titleView.setHorizontallyScrolling(true);
}
}
代码示例来源:origin: ABTSoftware/SciChart.Android.Examples
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final View view = super.getView(position, convertView, parent);
final TextView textView = (TextView) view.findViewById(R.id.text);
// Set here, it doesn't work when set in xml due to a bug
textView.setHorizontallyScrolling(true);
final String dataItem = data[position];
textView.setText(Html.fromHtml(dataItem));
return view;
}
代码示例来源:origin: stackoverflow.com
TextView tv = (TextView)findViewById(R.id.editText);
if (tv != null) {
tv.setHorizontallyScrolling(false);
tv.setLines(3);
}
代码示例来源:origin: Ronak-LM/memoir
void formatNameView(TextView view) {
if (view != null) {
view.setText(getName());
view.setHorizontallyScrolling(true);
}
}
代码示例来源:origin: stackoverflow.com
TextView textDescription = new TextView(this);
LinearLayout.LayoutParams layoutParamsDesc = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 25);
layoutParamsDesc.setMargins(10, 0, 10, 0);
textDescription.setLayoutParams(layoutParamsDesc);
textDescription.setText("Lengthy text in TextView");
textDescription.setEllipsize (TextUtils.TruncateAt.END);
textDescription.setSingleLine(true);
textDescription.setHorizontallyScrolling(false);
linearLayoutDatos.addView(textDescription);
代码示例来源:origin: GeoODK/collect
/**
* Add a TextView containing the help text.
*/
private void addHelpText(FormEntryPrompt p) {
String s = p.getHelpText();
if (s != null && !s.equals("")) {
mHelpText = new TextView(getContext());
mHelpText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mQuestionFontsize - 3);
mHelpText.setPadding(0, -5, 0, 7);
// wrap to the widget of view
mHelpText.setHorizontallyScrolling(false);
mHelpText.setText(s);
mHelpText.setTypeface(null, Typeface.ITALIC);
addView(mHelpText, mLayout);
}
}
代码示例来源:origin: topjohnwu/ProcGate
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_layout);
text = findViewById(R.id.text);
text.setMovementMethod(new ScrollingMovementMethod());
text.setHorizontallyScrolling(true);
}
代码示例来源:origin: stackoverflow.com
int width = getWindow().getDecorView().getMeasuredWidth();
//i am getting the overal width of the screen
Toast.makeText(getApplicationContext(), String.valueOf(width), Toast.LENGTH_SHORT).show();//toast it
for(int i =0; i < ((LinearLayout)findViewById(R.id.l)).getChildCount(); i++){
//looping through the parent container
TextView child = (TextView) ((LinearLayout)findViewById(R.id.l)).getChildAt(i);
child.setSelected(true);
child.setEllipsize(TruncateAt.MARQUEE);
child.setHorizontallyScrolling(true);
child.setSingleLine(true);
if(i+1 == 3){ //the last textview
child.setLayoutParams(new LinearLayout.LayoutParams(
((LinearLayout)findViewById(R.id.l)).getChildAt(1).getRight(),
LinearLayout.LayoutParams.WRAP_CONTENT));
}else{ // the first two take 1/3 of the width of the screen
child.setLayoutParams(new LinearLayout.LayoutParams(width/3, LinearLayout.LayoutParams.WRAP_CONTENT));
}
}
}
代码示例来源:origin: stackoverflow.com
TextView txt = new TextView(this);
txt.setText(“This is moving text”);
txt.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
txt.setTextColor(Color.rgb(187, 88, 15));
txt.setPadding(10, 10, 0, 0);
txt.setEllipsize(TruncateAt.MARQUEE);
txt.setSingleLine();
txt.setMarqueeRepeatLimit(10);
txt.setFocusable(true);
txt.setHorizontallyScrolling(true);
txt.setFocusableInTouchMode(true);
txt.requestFocus();
txt.setLayoutParams(new TableRow.LayoutParams(130, TableRow.LayoutParams.FILL_PARENT));
txt.setTypeface(Typeface.SERIF,Typeface.BOLD);
代码示例来源:origin: stackoverflow.com
TextView txt = new TextView(this);
txt.setText(“This is moving text”);
txt.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
txt.setTextColor(Color.rgb(187, 88, 15));
txt.setPadding(10, 10, 0, 0);
txt.setEllipsize(TruncateAt.MARQUEE);
txt.setSingleLine();
txt.setMarqueeRepeatLimit(10);
txt.setFocusable(true);
txt.setHorizontallyScrolling(true);
txt.setFocusableInTouchMode(true);
txt.requestFocus();
txt.setLayoutParams(new TableRow.LayoutParams(130, TableRow.LayoutParams.FILL_PARENT));
txt.setTypeface(Typeface.SERIF,Typeface.BOLD);
代码示例来源:origin: stackoverflow.com
TextView text_view = new TextView(context);
text_view.setLines(1);
text_view.setHorizontallyScrolling(true);
text_view.setMarqueeRepeatLimit(-1); // At this point the view is not scrolling!
...
text_view.setSelected(true); // Get scrolling to start
代码示例来源:origin: GeoODK/collect
protected void addQuestionText(FormEntryPrompt p) {
// Add the text view. Textview always exists, regardless of whether there's text.
TextView questionText = new TextView(getContext());
questionText.setText(p.getLongText());
questionText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mQuestionFontsize);
questionText.setTypeface(null, Typeface.BOLD);
questionText.setPadding(0, 0, 0, 7);
questionText.setId(QuestionWidget.newUniqueId()); // assign random id
// Wrap to the size of the parent view
questionText.setHorizontallyScrolling(false);
if (p.getLongText() == null) {
questionText.setVisibility(GONE);
}
// Put the question text on the left half of the screen
LinearLayout.LayoutParams labelParams =
new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
labelParams.weight = 1;
questionLayout = new LinearLayout(getContext());
questionLayout.setOrientation(LinearLayout.HORIZONTAL);
questionLayout.addView(questionText, labelParams);
}
代码示例来源:origin: GeoODK/collect
protected void addQuestionText(FormEntryPrompt p) {
// Add the text view. Textview always exists, regardless of whether there's text.
mQuestionText = new TextView(getContext());
mQuestionText.setText(p.getLongText());
mQuestionText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mQuestionFontsize);
mQuestionText.setTypeface(null, Typeface.BOLD);
mQuestionText.setPadding(0, 0, 0, 7);
mQuestionText.setId(QuestionWidget.newUniqueId()); // assign random id
// Wrap to the size of the parent view
mQuestionText.setHorizontallyScrolling(false);
if (p.getLongText() == null) {
mQuestionText.setVisibility(GONE);
}
// Put the question text on the left half of the screen
LinearLayout.LayoutParams labelParams =
new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
labelParams.weight = 1;
questionLayout = new LinearLayout(getContext());
questionLayout.setOrientation(LinearLayout.HORIZONTAL);
questionLayout.addView(mQuestionText, labelParams);
}
代码示例来源:origin: GeoODK/collect
protected void addQuestionText(FormEntryPrompt p) {
// Add the text view. Textview always exists, regardless of whether there's text.
TextView questionText = new TextView(getContext());
questionText.setText(p.getLongText());
questionText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mQuestionFontsize);
questionText.setTypeface(null, Typeface.BOLD);
questionText.setPadding(0, 0, 0, 7);
questionText.setId(QuestionWidget.newUniqueId()); // assign random id
// Wrap to the size of the parent view
questionText.setHorizontallyScrolling(false);
if (p.getLongText() == null) {
questionText.setVisibility(GONE);
}
// Put the question text on the left half of the screen
LinearLayout.LayoutParams labelParams =
new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
labelParams.weight = 1;
questionLayout = new LinearLayout(getContext());
questionLayout.setOrientation(LinearLayout.HORIZONTAL);
questionLayout.addView(questionText, labelParams);
}
代码示例来源:origin: GeoODK/collect
/**
* Add a Views containing the question text, audio (if applicable), and image (if applicable).
* To satisfy the RelativeLayout constraints, we add the audio first if it exists, then the
* TextView to fit the rest of the space, then the image if applicable.
*/
protected void addQuestionText(FormEntryPrompt p) {
String imageURI = p.getImageText();
String audioURI = p.getAudioText();
String videoURI = p.getSpecialFormQuestionText("video");
// shown when image is clicked
String bigImageURI = p.getSpecialFormQuestionText("big-image");
String promptText = p.getLongText();
// Add the text view. Textview always exists, regardless of whether there's text.
mQuestionText = new TextView(getContext());
mQuestionText.setText(promptText == null ? "" : promptText);
mQuestionText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mQuestionFontsize);
mQuestionText.setTypeface(null, Typeface.BOLD);
mQuestionText.setPadding(0, 0, 0, 7);
mQuestionText.setId(QuestionWidget.newUniqueId()); // assign random id
// Wrap to the size of the parent view
mQuestionText.setHorizontallyScrolling(false);
if (promptText == null || promptText.length() == 0) {
mQuestionText.setVisibility(GONE);
}
// Create the layout for audio, image, text
mediaLayout = new MediaLayout(getContext());
mediaLayout.setAVT(p.getIndex(), "", mQuestionText, audioURI, imageURI, videoURI, bigImageURI);
addView(mediaLayout, mLayout);
}
代码示例来源:origin: samlss/TimoMenu
private void initTextView(){
setNormalTextState();
mTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mTimoItemViewParameter.getTextSize());
mTextView.setEllipsize(mTimoItemViewParameter.getEllipsize());
mTextView.setGravity(Gravity.CENTER);
if (mTimoItemViewParameter.getEllipsize() == null
|| mTimoItemViewParameter.getEllipsize() == TextUtils.TruncateAt.MARQUEE) {
mTextView.setSingleLine(true);
mTextView.setMarqueeRepeatLimit(-1);
mTextView.setHorizontallyScrolling(true);
mTextView.setFocusable(true);
mTextView.setFocusableInTouchMode(true);
mTextView.setFreezesText(true);
}
LayoutParams layoutParams = new LayoutParams(mTimoItemViewParameter.getTextWidth(), mTimoItemViewParameter.getTextHeight());
if (mTimoItemViewParameter.getTextMargin() != null) {
layoutParams.leftMargin = mTimoItemViewParameter.getTextMargin().left;
layoutParams.topMargin = mTimoItemViewParameter.getTextMargin().top;
layoutParams.rightMargin = mTimoItemViewParameter.getTextMargin().right;
layoutParams.bottomMargin = mTimoItemViewParameter.getTextMargin().bottom;
}
if (mTimoItemViewParameter.getTextPadding() != null) {
mTextView.setPadding(mTimoItemViewParameter.getTextPadding().left,
mTimoItemViewParameter.getTextPadding().top,
mTimoItemViewParameter.getTextPadding().right,
mTimoItemViewParameter.getTextPadding().bottom);
}
addView(mTextView, layoutParams);
}
内容来源于网络,如有侵权,请联系作者删除!