Android的卷页动画由Harism显示在CurlActiviy的getBitmap()方法反向索引计数不一致()?索引、方法、动画、Android

2023-09-06 17:41:44 作者:一天到晚红烧的鱼

我用Harism的卷页动画我的应用程序,但我一直面临着一个小问题,我使用的指数值在CurlActivity的getBitmap()方法,我需要显示页码上的每个用户页面翻转(说用来Toast.maketext()显示通话中),这在从0页去pageCount.length工作正常,但是当我移动到左页右侧(页,即而走另一条路从pageCount.lenth为0)的索引值不一致减少。

任何人都可以请帮我这。

先谢谢了。

P.S.:That将是我的计算器上的第一个问题。

 公共位图getBitmap(INT宽度,高度INT,INT指数){        位图B = Bitmap.createBitmap(宽度,高度,                Bitmap.Config.ARGB_8888);        b.eraseColor(0xFFFFFFFF的);        帆布C =新的Canvas(B);        //这就是指数似乎出问题逆向计数,我相信        Log.e(PAGE--,+指数);        Toast.makeText(CurlActivity.this,+指数,Toast.LENGTH_SHORT).show();        可绘制D = getResources()getDrawable(mBitmapIds [指数])。        INT保证金= 7;        INT边界= 3; 

解决方案

问题是,你真的不能依靠请求的页面索引的目的,你尝试实施。原因你面临的问题是,一旦你翻动书页前进,只有下一页要求,在这种情况下,指数似乎是你期待什么。但改变的网页向后工作正好相反,只有'previous页'请求,并且有这些单独操作之间索引中的空白。

有一个方法CurlView.getCurrentIndex()虽然这是不断设置到页面索引上右侧被示出。它应该给你指具有实际显示页码。

iPhone 12上最酷的功能,其他手机也能用上了

I have used Harism's Page Curl animation for my application, but I have been facing a small problem, I am using the index Value in the getBitmap() method of the CurlActivity, I need to show page numbers to the user on every flip of the page(say using a call to Toast.maketext().show), this works fine while going from page 0 to pageCount.length, but when I move page right to left(the pages, i.e. while going the other way from pageCount.lenth to 0) the index values are not consistently reduced.

Can anyone please help me with this.

Thanks in Advance.

P.S.:That would be my first question on stackoverflow

            public Bitmap getBitmap(int width, int height, int index) {
        Bitmap b = Bitmap.createBitmap(width, height,
                Bitmap.Config.ARGB_8888);
        b.eraseColor(0xFFFFFFFF);
        Canvas c = new Canvas(b);

        //this is where index seems to go wrong on reverse counting, I believe

        Log.e("PAGE--", ""+index);
        Toast.makeText(CurlActivity.this, ""+index, Toast.LENGTH_SHORT).show();

        Drawable d = getResources().getDrawable(mBitmapIds[index]);

        int margin = 7;
        int border = 3;

解决方案

Problem is that you really can't rely on requested page index on purpose you try to implement. Reason for the behavior you're facing is that once you flip through pages forward, only 'next page' is requested, in which case index seems to be what you're expecting. But changing pages backwards works the exact opposite, only 'previous page' is requested, and there's a gap within index between these separate operations.

There's a method CurlView.getCurrentIndex() though which is constantly set to index of the page being shown on right side. It should give you means for having actual page numbers shown.