本文整理汇总了Java中android.widget.TextView.setHorizontallyScrolling方法的典型用法代码示例。如果您正苦于以下问题:Java TextView.setHorizontallyScrolling方法的具体用法?Java TextView.setHorizontallyScrolling怎么用?Java TextView.setHorizontallyScrolling使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.TextView
的用法示例。
在下文中一共展示了TextView.setHorizontallyScrolling方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTextView
import android.widget.TextView; //导入方法依赖的package包/类
private TextView createTextView() {
TextView textView = new TextView(mContext);
textView.setTypeface(Typeface.MONOSPACE);
textView.setTextColor(Color.WHITE);
textView.setHorizontallyScrolling(true);
if (mTextSize > 0) textView.setTextSize(mTextSize);
//textView.setEllipsize(TextUtils.TruncateAt.MARQUEE);
//textView.setPadding(0, 0, 2, 0);
return textView;
}
示例2: getView
import android.widget.TextView; //导入方法依赖的package包/类
@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;
}
示例3: getView
import android.widget.TextView; //导入方法依赖的package包/类
@Override
public View getView(int index, View contextView, ViewGroup parent) {
final String floorName = (String) getItem(index);
if (contextView == null) {
LayoutInflater inflater = (LayoutInflater) parent.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
contextView = inflater.inflate(m_itemViewId, null);
}
TextView nameLabel = (TextView) contextView.findViewById(R.id.floor_name);
nameLabel.setText(floorName);
nameLabel.setHorizontallyScrolling(false);
nameLabel.setSingleLine();
View upperLine = (View) contextView.findViewById(R.id.interiors_explorer_floor_list_item_topline);
if (upperLine != null) {
upperLine.setVisibility(index == 0 ? View.INVISIBLE : View.VISIBLE);
}
View bottomLine = (View) contextView.findViewById(R.id.interiors_explorer_floor_list_item_bottomline);
if (bottomLine != null) {
bottomLine.setVisibility(index == m_nameData.size() - 1 ? View.INVISIBLE : View.VISIBLE);
}
return contextView;
}
示例4: setText
import android.widget.TextView; //导入方法依赖的package包/类
private void setText(TextView v, Spanned text, boolean scrolling){
if (v == null){
return;
}
if (Utils.isEmpty(text)){
v.setVisibility(View.GONE);
}else{
v.setText(text);
}
v.setMovementMethod(LinkMovementMethod.getInstance());
v.setHorizontallyScrolling(scrolling);
}
示例5: onInsertImageUrlClicked
import android.widget.TextView; //导入方法依赖的package包/类
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);
});
}
示例6: fixedTextViewEllipsizeEnd
import android.widget.TextView; //导入方法依赖的package包/类
/**
* Android4.0.4,解决:设置了android:ellipsize="end",但“...”不显示的问题;
* Android4.4,解决:文本两边不能贴边的问题;
*
* @param textView
*/
public static void fixedTextViewEllipsizeEnd(TextView textView) {
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT) {
textView.setHorizontallyScrolling(true);
}
}