本文整理匯總了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);
}
}