Android 以相同的顺序放置 2 个文本视图

Android put 2 textview in same order

我有 2 个文本视图。

第一

   <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="If you would like to provide feedback on the ehospice app, or report an error or problem, please "
                    android:textColor="#000000"/>

第 2(在我的 activity 中,我在其上使用了 clicklistener 并在其下划线)

<TextView
                    android:id="@+id/send_us_an_email"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="send us an email."
                    android:textColor="#000000" />

当我启动应用程序时,第二个 TextView 会换行,怎么可能像这样在 final 中制作:

If you would like to provide feedback on the ehospice app, or report an error or problem, please send us an email. (send us an email. is underlined didnt know to to put here :))

如果您使用的是线性布局,请将 orientation 属性 设置为 horizontal,并将这两个作为线性布局的子视图..

你应该在一个 TextView 中,然后你应该使用这样的东西:

        SpannableString ss = new SpannableString("If you would like to provide feedback on the ehospice app, or report an error or problem, please send us an email.");
        ClickableSpan clickableSpan = new ClickableSpan() {
            @Override
            public void onClick(View textView) {
                //your code for click
            }
        };
        ss.setSpan(clickableSpan, position_of_first_send_email_character, ss.length() - 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

        TextView textView = (TextView) findViewById(R.id.your_text_view_id);
        textView.setText(ss);
        textView.setMovementMethod(LinkMovementMethod.getInstance());

因为水平方向的方式不适用于小型设备中的第一个大字符串