• <small id='nJd5z'></small><noframes id='nJd5z'>

      <legend id='nJd5z'><style id='nJd5z'><dir id='nJd5z'><q id='nJd5z'></q></dir></style></legend>

      <i id='nJd5z'><tr id='nJd5z'><dt id='nJd5z'><q id='nJd5z'><span id='nJd5z'><b id='nJd5z'><form id='nJd5z'><ins id='nJd5z'></ins><ul id='nJd5z'></ul><sub id='nJd5z'></sub></form><legend id='nJd5z'></legend><bdo id='nJd5z'><pre id='nJd5z'><center id='nJd5z'></center></pre></bdo></b><th id='nJd5z'></th></span></q></dt></tr></i><div id='nJd5z'><tfoot id='nJd5z'></tfoot><dl id='nJd5z'><fieldset id='nJd5z'></fieldset></dl></div>

        <tfoot id='nJd5z'></tfoot>

        • <bdo id='nJd5z'></bdo><ul id='nJd5z'></ul>

      1. Android:以编程方式在图库小部件中的图像之间设置动画

        Android: Programmatically animate between images in Gallery widget(Android:以编程方式在图库小部件中的图像之间设置动画)

        <small id='nfW0D'></small><noframes id='nfW0D'>

      2. <i id='nfW0D'><tr id='nfW0D'><dt id='nfW0D'><q id='nfW0D'><span id='nfW0D'><b id='nfW0D'><form id='nfW0D'><ins id='nfW0D'></ins><ul id='nfW0D'></ul><sub id='nfW0D'></sub></form><legend id='nfW0D'></legend><bdo id='nfW0D'><pre id='nfW0D'><center id='nfW0D'></center></pre></bdo></b><th id='nfW0D'></th></span></q></dt></tr></i><div id='nfW0D'><tfoot id='nfW0D'></tfoot><dl id='nfW0D'><fieldset id='nfW0D'></fieldset></dl></div>
      3. <tfoot id='nfW0D'></tfoot>
      4. <legend id='nfW0D'><style id='nfW0D'><dir id='nfW0D'><q id='nfW0D'></q></dir></style></legend>
            <tbody id='nfW0D'></tbody>

                • <bdo id='nfW0D'></bdo><ul id='nfW0D'></ul>
                  本文介绍了Android:以编程方式在图库小部件中的图像之间设置动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  注意:从 Jellybean 开始,画廊小部件已被弃用.应该使用 ViewPager.

                  Note: As of Jellybean the gallery widget is deprecated. A ViewPager should be used instead.

                  我想以编程方式在图库小部件中的图像之间移动,并带有动画.

                  I'd like to programmatically move between images in the Gallery widget, with animation.

                  我可以使用 setSelection(int position) 方法更改当前显示的图像,但这不会动画.然后是 setSelection(int position, bool animate) 但最后的额外布尔值似乎没有做任何事情.

                  I can change the currently displaying image using the setSelection(int position) method, however that does not animate. Then there's setSelection(int position, bool animate) but the extra boolean on the end there doesn't appear to do anything.

                  在 图库来源 看来它可以处理 DPAD 按键,所以我想到的解决方法是伪造按键.例如.

                  In the source of Gallery it appears that it can handle DPAD key-presses, so a work-around I thought of was to fake the key-presses. Eg.

                  dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DPAD_LEFT))
                  

                  但是由于某种原因,我无法使其正常工作.有人试过吗?

                  However I can't get this working for some reason. Anyone tried this?

                  我注意到我喜欢使用的三个小部件方法 moveNext()movePrevious()scrollToChild() 都是私密且无法使用.

                  I notice three of the widget's methods I'd love to use moveNext(), movePrevious() and scrollToChild() are all private and unusable.

                  有谁知道我怎么能做到这一点?

                  Does anyone know how I might be able to do this?

                  推荐答案

                  直接调用图库的按键处理程序即可:

                  Just call the key press handler for the gallery directly:

                  public boolean onKeyDown(int keyCode, KeyEvent event)
                  

                  Gallery gallery = ((Gallery) findViewById(R.id.gallery));
                  
                  gallery.onKeyDown(KeyEvent.KEYCODE_DPAD_LEFT, new KeyEvent(0, 0));
                  

                  一件重要的事情 - 此解决方案仅在已创建左侧/右侧的孩子时才有效,这意味着它必须是可见的".如果您的图像全屏显示 - 考虑将间距设置为 -1 值.

                  One important thing - this solution works only if child that is on left/right was already created, which means that it has to be 'visible'. If you have your image on fullscreen - consider setting spacing to -1 value.

                  这篇关于Android:以编程方式在图库小部件中的图像之间设置动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Cocos2d - apply GLImageProcessing effect to CCSprite(Cocos2d - 对 CCSprite 应用 GLImageProcessing 效果)
                  How can I use CClistview in COCOS2d Android?(如何在 COCOS2d Android 中使用 CClistview?)
                  cocos2d-android: how to display score(cocos2d-android:如何显示分数)
                  Sqlite database not copied from asset folder Android(Sqlite 数据库未从资产文件夹 Android 复制)
                  SQLite Database Copy Appears Corrupted When Generated by Device and not Emulator(SQLite 数据库副本在由设备而不是模拟器生成时出现损坏)
                  Android file copy(安卓文件拷贝)

                • <tfoot id='nfFqc'></tfoot>

                      <i id='nfFqc'><tr id='nfFqc'><dt id='nfFqc'><q id='nfFqc'><span id='nfFqc'><b id='nfFqc'><form id='nfFqc'><ins id='nfFqc'></ins><ul id='nfFqc'></ul><sub id='nfFqc'></sub></form><legend id='nfFqc'></legend><bdo id='nfFqc'><pre id='nfFqc'><center id='nfFqc'></center></pre></bdo></b><th id='nfFqc'></th></span></q></dt></tr></i><div id='nfFqc'><tfoot id='nfFqc'></tfoot><dl id='nfFqc'><fieldset id='nfFqc'></fieldset></dl></div>
                        <tbody id='nfFqc'></tbody>

                      <small id='nfFqc'></small><noframes id='nfFqc'>

                      <legend id='nfFqc'><style id='nfFqc'><dir id='nfFqc'><q id='nfFqc'></q></dir></style></legend>

                            <bdo id='nfFqc'></bdo><ul id='nfFqc'></ul>