Android以同样的顺序放置2个textview

时间:2015-05-10 08:07:35

标签: android textview

我收到了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"/>

2nd(在我的活动中,我使用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进入一个新的行,如何在最后这样做:

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 :))

2 个答案:

答案 0 :(得分:1)

你应该在一个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());

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

答案 1 :(得分:0)

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