动画后如何动态设置大于动画宽度的textView宽度?

时间:2016-01-26 12:04:20

标签: android animation

我有一个文本视图,其高度包装内容和宽度匹配父级。这样textView宽度==屏幕宽度。 但有一点我希望文本旋转90度。 现在我希望能够更改视图宽度,使其成为设备高度而不是宽度。 这将导致宽度扩大。 (基本上就像改变方向时一样,但我只能对一个文本视图进行方向更改,所以我必须旋转它。)

我的问题:我无法将textViews宽度设置为大于设备宽度。 即使我已经完成了动画。

那么可以使textView宽度大于设备宽度吗? 如果不是,任何人都可以建议我如何解决我的问题,因为我真的需要改变textView的方向......

EDIT ---- EDIT

有没有办法创建横向文本视图并将其放在一个portait活动中?这将完全解决我上周的问题......

修改

我的片段:

<RelativeLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/f"
    >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/t"
        />
</RelativeLayout>

我尝试了不同的东西,比如

fragment.setRotation(90);
  LayoutParams params = fragment.getLayoutParams();
                params.height = text.getHeight();
                params.width = deviceHeight;
                fragment.setLayoutParams(params);

 LayoutParams params1 = text.getLayoutParams();
                params1.height = text.getHeight();
                params1.width = deviceHeight;
                text.setLayoutParams(params1);

EDIT ________ EDIT

或者有没有人写过像verticalTextView类?

1 个答案:

答案 0 :(得分:0)

您可以将TextView的属性设置为android:singleLine="true"android:layout_width="wrap_content"以及android:layout_height="wrap_content" // incase if you do not want the height to be increashed,以便singleLine使文字超出屏幕宽度然后您这种行为需要ScrollView

希望这有帮助。

相关问题