我正在制作textView
动画,就像电影后的演员表一样(滑入屏幕然后滑出屏幕),然而textView
无法显示我的所有文字,即使我使用{ {1}}。
布局xml:
wrap_content
向上滑动动画,slideup_in.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f2f1ef"
android:clipChildren="false"
android:paddingBottom="150dp"
android:paddingLeft="30dp"
android:paddingRight="30dp"
android:paddingTop="150dp" >
<TextView
android:id="@+id/story_txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing"
android:textSize="60sp" />
</LinearLayout>
活动:
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator"
android:fromYDelta="125%"
android:toYDelta="-150%"
android:duration="20000" />
答案 0 :(得分:0)
android:toYDelta="-150%"
此代码允许您在原始位置上方运行textview。如果您想将其恢复到原来的位置,请使用
android:toYDelta="100%"
答案 1 :(得分:0)
由于android:paddingBottom="150dp"
和android:paddingTop="150dp"
删除了这些问题,因此问题应该消失了。
您的布局XML应如下所示:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f2f1ef"
android:clipChildren="false"
android:paddingLeft="30dp"
android:paddingRight="30dp">
<TextView
android:id="@+id/story_txt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing"
android:textSize="60sp" />
</LinearLayout>
如果您确实需要在顶部和底部填充,则应使用较小的值,例如15dp。 150dp太多,导致文本没有填满可用空间。
答案 2 :(得分:0)
这里的问题是你的TextView
的最大高度值等于你的屏幕高度(不考虑填充)。之所以发生这种情况,是因为您的布局父LinearLayout
有View
。您的TextView
内容需要的内容超过屏幕高度,因此您可以完全看到它。
如果您将其更改为ScrollView
,则您的所有内容都将完全可见,因为ScrollView
显然对其内容高度没有限制。