Java Code Examples for android.widget.TextView.setHorizontallyScrolling()

The following are Jave code examples for showing how to use setHorizontallyScrolling() of the android.widget.TextView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: planetcon   File: TextAdapter.java   View Source Code Vote up 5 votes
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;
}
 
Example 2
Project: SciChart.Android.Examples   File: ShowCodeActivity.java   View Source Code Vote up 5 votes
@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;
}
 
Example 3
Project: android-api   File: IndoorFloorListAdapter.java   View Source Code Vote up 5 votes
@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;
}
 
Example 4
Project: AboutView   File: AboutView.java   View Source Code Vote up 5 votes
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);
}
 
Example 5
Project: Ghost-Android   File: PostEditFragment.java   View Source Code Vote up 4 votes
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);
    });
}
 
Example 6
Project: Accessibility   File: AndroidUtilsCompat.java   View Source Code Vote up 2 votes
/**
 * 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);
    }
}