简体   繁体   English

缩放Android ListView而不缩放内部内容

[英]Scaling an Android ListView without scaling the contents inside

Basically I want to create a sliding menu. 基本上我想创建一个滑动菜单。

I have managed to slide a ListView from left to right. 我设法从左向右滑动ListView。 Within the ListView are 3 buttons which I want to appear as the menu slides open. 在ListView中有3个按钮,我希望它们在菜单幻灯片打开时出现。 Unfortunately the scale animation is resizing the buttons within the ListView as it scales. 不幸的是,缩放动画在缩放时会调整ListView中按钮的大小。

Can anyone tell me how to scale ListViews without scaling the contents of the view at the same time? 谁能告诉我如何缩放ListViews而不同时缩放视图的内容?

Thanks 谢谢

One way might be to create the ListView in negative x co-ords and then slide it fully formed into place by applying an animation to it such as this one: 一种方法可能是以负x坐标创建ListView,然后通过向其应用动画来将其完全滑动到适当的位置,如下所示:

<?xml version="1.0" encoding="utf-8"?>
<set
    xmlns:android="http://schemas.android.com/apk/res/android">
    <translate
        android:fromXDelta="-100%"
        android:toXDelta="0"
        android:duration="300" />
    <alpha
        android:fromAlpha="0.0"
        android:toAlpha="1.0"
        android:duration="300" />
</set>

Also, I can't tell, but from what you are saying, you are changing the size of the container (the list) as you animate, so of course it will change the size of it's children. 另外,我不能说,但是根据您的意思,您在设置动画时正在更改容器(列表)的大小,因此,当然,它会更改其子对象的大小。
A translate of some kind is probably your best option. 某种翻译可能是您的最佳选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM