Java 第二个活动的文本视图中的文本超出了sceen,但适用于更大的显示手机
我有两个活动,我将一些数据,即点击按钮时的用户名和密码,分别传递到第二个活动的Java 第二个活动的文本视图中的文本超出了sceen,但适用于更大的显示手机,java,xml,android-studio,android-layout,android-resources,Java,Xml,Android Studio,Android Layout,Android Resources,我有两个活动,我将一些数据,即点击按钮时的用户名和密码,分别传递到第二个活动的textview,问题是,当我在usernameedittext字段中输入12个字符时,它会被传递并在第二个活动中显示,但当尝试输入超过12个字符时,它不会显示前12个字符以外的最后一个字符 因此,如何显示从第一个活动传递的全文 注意:我已将textview最大行数设置为“1”。(这是我的要求) first activity editText.xml 第二个活动textView.xml 为视图提供填充,如下所示
textview
,问题是,当我在usernameedittext
字段中输入12个字符时,它会被传递并在第二个活动中显示,但当尝试输入超过12个字符时,它不会显示前12个字符以外的最后一个字符
因此,如何显示从第一个活动传递的全文
注意:我已将textview最大行数设置为“1”。(这是我的要求)
first activity editText.xml
第二个活动textView.xml
为视图提供填充,如下所示
<TextView
android:id="@+id/username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_padding="16dp"
android:maxLines="1"
android:textSize="20sp" />
试试这个,希望它能奏效
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/mytextvieww"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:maxLines="1"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
在我添加了android:layout_padding=“16dp”之后,构建失败,显示了一个未知padding属性的错误。您可以为它的父视图提供padding