下面列出了android.widget.TextView#setHorizontallyScrolling ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
protected void addQuestionText() {
// Add the text view. Textview always exists, regardless of whether there's text.
TextView questionText = new TextView(getContext());
setQuestionText(questionText, mPrompt);
questionText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, TEXTSIZE);
questionText.setTypeface(null, Typeface.BOLD);
questionText.setPadding(0, 0, 0, 7);
questionText.setId(buttonIdBase); // assign random id
// Wrap to the size of the parent view
questionText.setHorizontallyScrolling(false);
if (mPrompt.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);
}
private void updateSpinnerTitle(TextView titleView) {
if (titleView != null) {
titleView.setText(mSpinnerTitle);
titleView.setVisibility((mSpinnerTitle == null) ? View.GONE : View.VISIBLE);
titleView.setHorizontallyScrolling(true);
}
}
private void updateSpinnerTitle(TextView titleView) {
if (titleView != null) {
titleView.setText(mSpinnerTitle);
titleView.setVisibility((mSpinnerTitle == null) ? View.GONE : View.VISIBLE);
titleView.setHorizontallyScrolling(true);
}
}
private void updateSpinnerTitle(TextView titleView) {
if (titleView != null) {
titleView.setText(mSpinnerTitle);
titleView.setVisibility((mSpinnerTitle == null) ? View.GONE : View.VISIBLE);
titleView.setHorizontallyScrolling(true);
}
}
private void addHintText(String hintText) {
if (hintText != null && !hintText.equals("")) {
TextView 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(hintText);
mHelpText.setTypeface(null, Typeface.ITALIC);
mViewBannerCount++;
mView.addView(mHelpText, mLayout);
}
}
@Override
protected void addQuestionText() {
// Add the text view. Textview always exists, regardless of whether there's text.
mQuestionText = new TextView(getContext());
setQuestionText(mQuestionText, mPrompt);
mQuestionText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, TEXTSIZE);
mQuestionText.setTypeface(null, Typeface.BOLD);
mQuestionText.setPadding(0, 0, 0, 7);
mQuestionText.setId(RANDOM_BUTTON_ID); // assign random id
// Wrap to the size of the parent view
mQuestionText.setHorizontallyScrolling(false);
if (mPrompt.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);
}
@Override
protected void addQuestionText() {
// Add the text view. Textview always exists, regardless of whether there's text.
TextView questionText = new TextView(getContext());
setQuestionText(questionText, mPrompt);
questionText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, TEXTSIZE);
questionText.setTypeface(null, Typeface.BOLD);
questionText.setPadding(0, 0, 0, 7);
questionText.setId(buttonIdBase); // assign random id
// Wrap to the size of the parent view
questionText.setHorizontallyScrolling(false);
if (mPrompt.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);
}
public void setQuestionText(TextView textView, FormEntryPrompt prompt) {
textView.setText(getTextFromPrompt(prompt));
if (prompt.getMarkdownText() != null) {
textView.setMovementMethod(LinkMovementMethod.getInstance());
// Wrap to the size of the parent view
textView.setHorizontallyScrolling(false);
}
}
void formatNameView(TextView view) {
if (view != null) {
view.setText(getName());
view.setHorizontallyScrolling(true);
}
}
void formatNameView(TextView view) {
if (view != null) {
view.setText(getName());
view.setHorizontallyScrolling(true);
}
}
void formatNameView(TextView view) {
if (view != null) {
view.setText(getName());
view.setHorizontallyScrolling(true);
}
}
public void onInsertImageUrlClicked(Action1<String> resultAction) {
// ok to pass null here: https://possiblemobile.com/2013/05/layout-inflation-as-intended/
@SuppressLint("InflateParams")
final View dialogView = mActivity.getLayoutInflater().inflate(R.layout.dialog_image_insert,
null, false);
final TextView imageUrlView = (TextView) dialogView.findViewById(R.id.image_url);
// hack for word wrap with "Done" IME action! see http://stackoverflow.com/a/13563946/504611
imageUrlView.setHorizontallyScrolling(false);
imageUrlView.setMaxLines(20);
Observable<String> imageUrlObservable = Observables.getDialog(emitter -> {
AlertDialog dialog = new AlertDialog.Builder(mActivity)
.setTitle(mActivity.getString(R.string.insert_image))
.setView(dialogView)
.setCancelable(true)
.setPositiveButton(R.string.insert, (d, which) -> {
emitter.onNext(imageUrlView.getText().toString());
emitter.onComplete();
})
.setNegativeButton(android.R.string.cancel, (d, which) -> {
d.dismiss();
emitter.onComplete();
})
.create();
imageUrlView.setOnEditorActionListener((view, actionId, event) -> {
if (actionId == EditorInfo.IME_ACTION_DONE) {
dialog.getButton(DialogInterface.BUTTON_POSITIVE).performClick();
return true;
}
return false;
});
return dialog;
});
imageUrlObservable.subscribe((imageUrl) -> {
resultAction.call(imageUrl);
mMarkdownEditSelectionState = null;
KeyboardUtils.focusAndShowKeyboard(mActivity, mPostEditView);
});
}
public ExecutorStatus (final TextView textView) {
this.textView = textView;
textView.setHorizontallyScrolling(true);
textView.setEllipsize(null);
this.refreshUiHandler = new RefreshUiHandler(this);
}