Android: render multiple views in a ScrollView - scrollview

Have a code that renders custom Views and placed on a ScrollView (n by n) with dynamic width per view.
I've been having sluggish performance when running it in Tablet 10.1 but seems ok in Tablet 7.0.
Would there be any improvements if I replaced Views with SurfaceView?
Or would a single SurfaceView with mapped cell work instead? I've found this sample project but using this as a guide for the current code seems.. difficult, what with different widths on custom views and the resolution on other devices.
Any other suggestions?

It depends on the hardware but if you are running on the emulator, it's not accurate. If you are using real devices, try to avoid using custom a lot of custom views because it will be sluggish in a scrollview. Try at least to use standard widgets and move the "custom" parts to another view, it's the simplest, most accesible, and easier to code solution to your problem.
A listview calling another activity would be the fastest and most user friendly approach IMHO.

Related

can you set a predetermined billing app qt?

can you set a vertical orientation in a qml app?
if so?
I have searched on various sites to try and solve this problem. I found it in C ++ code but I would need the piece of code in qml language
I'm using the application project - qt quick application - empty
I'm using a version of qt 5.10.1
thank you
You're looking for Screen.orientationUpdateMask.
Once the mask is set, Screen.orientation will contain the current orientation of the screen.You can read more about the Screem QML type here. Of course the orientation in this case is set by the accelerometer.
If you want to be able to go back and forth between portrait and landscape without the use of the accelerometer and while having the logic in qml you will need to use the Transform, Scale and Rotation QML types. I wouldn't recommend this approach.
One alternative to using Transform would be to use two different views all together, which might not be a good idea for maintainability especially if you want to use the 4 orientations.
If you want to force the orientation no matter what you can do it in the manifest file as you would normally without Qt.

ReactJS - is there any recommended way to games (2D Tile Maps)

We are doing a small mobile game with react-native. But now we are not sure if react-native is a good choice for what we wanted to create.
Our game is simply just working with tiles in a not that small "map". Lets say its 1000 x 1000 Tiles so at the end 1.000.000 Tiles.
1) Our first try was to render 1 Mio. Components - which ended bad. Even 100 x 100 is like impossible to render with react-native.
2) We ended up to add some logic which renders just tiles inside the view. But when doing any action (and new tiles get rendered) the app is laggy as hell.
3) So we made sure no Tile get ever recreated and instead we just changed props so the tile change the position instead of being recreated. This ended up also in a laggy as hell experience (even when its like 20 Tiles just changing the prop).
After these we decided that React-Native has no nice performance for what we wanted to create: A big tile map with some interactions.
4) So we were thinking of using canvas for drawing the tiles in our react-native app, but it seems that this is also not the common way. We've found some canvas packages for react-native but these are just adding a few components which are useless for our project - with these components we would also end up by rendering components like . But the goal would be to have one ref where we can use the canvas benefits.
So - if react-native is too laggy for doing stuff like this in his own way and canvas is not useable as it is in web what would be the recommended way to solve a project like this ? Or is the answer maybe that react-native is the wrong system to solve a project like this ? Any suggestions ?
IMHO, I will never recommend react-native to make a game like you are describing (with tilemap), less-UI-focused games like poker, trading cards is totally fine though.
But you are likely rendering thousands of tiles without any clipping? How about try to enable View clipping? See removeClippedSubviews here: https://facebook.github.io/react-native/docs/view.html
If you still want to push with react-native, I suggest using plugins like this: https://github.com/ProjectSeptemberInc/gl-react-native
The purpose is to have an OpenGL ES canvas to accelerate your game rendering.
Otherwise, for 2D games, cocos2d-js seems fit to you (it seems your background is javascript), although it will requires some compiler knowledge to get the game actually running on mobile device. The other solution would be Unity 3D (2D is completely find with this engine). Each engine has their own pros/cons, so I would suggest you to try both at basic level to see which one is more suitable.

mfmailcomposer cuts end of html email

I've created an in app email feature to ask a question that opens the mfmailcomposer and fills it with html content. Unfortunately it seems to cut off the final line of the email so it appears as the image below.
I have set the mfmailcomposer to self, followed every tutorial I can find, the only reference to fix it has said the following:
make sure your mfmailcomposer is set to self ie. [self presentModalViewController:email animated:YES];
make sure it's embedded within a navigation controller
Neither solution works.
I have found that if the email contents is short enough that the entire email fits on screen the problem doesn't appear but if you continue typing to push the contents off the edge it reappears.
Any ideas on a solution? Or is this an Apple xcode "design feature"?
I managed to resolve this issue, it seems to be a bug, that's the only explanation I can reach.
If the start of your content is a header (<h1>, <h2>, <h3>, etc) tag (even if it is within a HTML and BODY tag) it creates this issue.
If you want to start your email body with a header tag then the simplest way of fixing it is to add a non breaking spacer before the header tag, it seems to completely resolve the issue.
Possibly a framework bug. Does it occur on different versions of iOS? Try it with both older and newer versions of the operating system and on other devices.
Are you 100% certain that the view is not actually larger than its container view? Explore the view hierarchy. Perhaps in plaintext Apple adds some spacing, so it doesn't seem like the content is out of bounds of the parent view, although it is.
How do scroll indicators behave? Are they also clipped?
Are you presenting the message composer in a fullscreen view? If you're trying to present it in a view that is controlled by a sub-controller of the tab view controller, that might cause the composer view controller to be confused.
For what it's worth, I've just tested my code which generates HTML content, and there is no clipping. This is on iOS 4.2.1 on iPhone 3G, but I don't remember seeing the problem on iOS 5.1 either.
Some tips.
While debugging, don't forget: view controllers are actually just managing views that still have their own hierarchies. To clarify, view controllers may have a hierarchy, but their hierarchy does not necessarily correspond to view hierarchy. (Although it should in the near total majority of cases.) Same thing with views themselves: they have their hierarchy, but they still just control the underlying Core Animation layers, which have their own hierarchy.
You can always access view hierarchy itself and explore it in greater detail through debugging facilities you come up with yourself. What you shouldn't be doing is meddling too much in parts of the view hierarchy that's supposed to be managed by the view controllers, just like you shouldn't mess too much with the parts of the layer hierarchy that's supposed to be managed by the views.

How to Handle iPad Rotation?

I have the core of an iPad app made up, its relatively simple. However I want to add support to portrait mode (currently works in landscape). Trouble is, its quite a customised, unique interface, made of different uiimages, labels, etc
So how when the user rotates the iPad, can I handle the movement of all these objects? Whats the best way to do it?
Thanks.
If you have designed the interface in interface builder, you can build up the relationships between GUI elements through the interface builder, and at a first shot, see what it does with the rotation. This MAY work for you, I know there are interfaces I have designed where this is NOT an option, and others where it works just fine.
Else, You may have to write all of the positioning code yourself. Probably the Best way to do this from my experiance is to use pre-processor directives to define your positions for all of your elements in each of the 2 orientations. This way you write the routines for manipulation and then your small tweaks that you may need to make after you let it run the first time can simply be numeric tweaks in your pre-processor directives file.
http://bynomial.com/blog/?p=85
http://the.ichibod.com/kiji/how-to-handle-device-rotation-for-uiviews-in-ios/

SemanticZoom is not gracefully

I am using SemanticZoom in my project. it works fine but is not handled gracefully. What can I do to make its work more smoothe?
Since your question is quite vague, the general recommendation I could give you is to make the zoomed in and out views similar in structure. For example, if your zoomed in view displays a mostly-horizontal GridView then your zoomed out view should display a similarly structured, horizontal layout. Consider the Start menu in Windows 8. A FAIL would be if the zoomed out view showed grouped icons stacked vertically - that would be visually jarring. The best practice is to remain consistent between views, just changing context.
If what you mean is the performance of the animation, then it might be that the complexity of your two views is more than you can reasonably show on YOUR hardware. Be happy you discovered this on your hardware instead of your users discovering it on theirs. There is no real resolution to this other than decomposing your two views and reconsidering the complexity of the overall design. Before you do this, test of a simple set of views and see.
Semantic zoom should be easy for the user to understand. More importantly, you SHOULD use it because it is a regular part of a metro application and users are right to expect it. The execution of the animation is hardware based so you should have a fluid transition. However, all hardware is not created equally, so don't push the limits - just make an excellent app.