I have a very simple requirement where I need a screen divided into two pieces where the first half is used to input data and the other is to display results based on the input (very similar to frames in browsers). the first half will remain static and will never change.
Is there a way to do it without using fragments and just by using layouts ?
As mentioned by m0skit0 just divide the screen by two with a layout and put the static part on one side and for example a WebView on the other side that you update with the content you want to show (or any other view of course).
Related
I want to develop a dynamic matching game for Android. I want the change the board size from 4x4 up to 8x8 (eg. 7x4 and 5x4 would be valid sizes), depending on the level of difficulty chosen. This means I can have a 5x4, 7x4 board, and so on.
I also want to handle orientation change in this game. This means I want to change the board dimensions in the orientation changes (eg. a portrait 5 x 4 can became a 4 x 5 landscape).
I came up with two different approaches.
Create #N different layout files using Constraint Layout. Then I put some logic in my fragment to decide which layout file to pick up. This would handle almost all the complexity of making it dynamic once the constraint layouts will shrink and stretch automatically.
The downsides I realized:
a. code will look messy. I would have to findViewById depending on the layout chosen;
b. configuration change might be an issue, once I'd have to change the layout file on the fly;
c. maintenance would be hard. Imagine maintaining all these XML files.
Use GridView. I can make it all dynamic. The Adapter binds it for me, I just need to tell the GridView how many columns I want.
Downsides:
a. I need to come up with magic math to make it fit;
b. height is an issue and onBind might mess me up is the ViewHolder decides to rebind the views.
At this point, I'm inclined to go for the first option. But I'm worried about making a decision I'd regret after.
Any advice or suggestion?
Thanks in advance,
Daniel
I am creating a game with circular buttons. I am thinking about a strategy that allows me to display variety of buttons in variety of positions in the same screen in an efficient way.
Like,
Sample images:
Image 1: 1 button
Image 4: 4 Buttons
The game works on seconds and I want the images to be changing so smoothly and should not take much time for transition. My ideas to implement this are below. Please advise me the best way to achieve this.
Use Grid view and populate items as required.
Use Open GL to display buttons.
Use a fragment and assign layouts as required.
Any other perfect way you suggest.
Note: I don't use strips to animate. All I want to do is just to do some calculation according to which button the player picks to click. And my concerns are,
1. Quick and smooth transition of layouts.
please guide me to pick the right path.
Thanks,
Karthick.
Good day, i am developing an android app which generates comic like albums, i need to fit this comic to any screen width but i have trouble doing it coz of the layouts, its very odd and doesn't seem to be aligned with one another, here :
those boxe are composed of FrameLayouts which contains and ImageView (back), the frame which is a PNG (middle) and a TextView on top of the frame image. So basically the design is very complex and odd, I've heard that there is a way to make this fit automatically on every screen on IOS, they called it auto layout i guess. Is there a counter part of this on android? Thank you.
Try using a GridLayout. You should be able to achieve what you're trying to do. There's a good blog post here.
working on an app and The way I want to set it up is different than what I have ever done before. I want the main activity when launched into the app to exceed past the boundaries of the physical phone screen, and for the user to be able to swipe out to parts of the app that they can't originally see.
I am not sure what the terminology is or what methods or classes etc to use. Any info that could point me in the right direction would be great! Thanks!
Just some clarification:
I think what I'm trying to say is the second thing you talked about. Imagine if you place a iPhone for example in the middle of a piece of computer paper. What I want to achieve is to have the whole view the size of the paper, but only be able to see the size of the iPhone's screen at a time. So you can go up a little bit and see what was above the screen, or left or right
If you want more screens and be able to switch between them, use ViewPager.
If you want one large view bigger than screen, you can either combine ScrollView for vertical scrolling and HorizontalScrollView for horizontal scrolling, or make some custom View, which will be able to scroll (you have to implement it on your own) in both direction.
If you want to have just some views outside of the screen and bring them to visible area on some event, you can use RelativeLayout and set to its views proper margin.
If you want something else, add more information, how it should look and act like.
At the moment, I am using Euro 2012 app and it has some interesting layout parts. If you go to matches->knockout screen, you'll see 3 screens like this.
If you slide left or right, you move between them not like between one activity to another, but just like all these elements are laid on one big canvas and you slide each screen into focus. Even thou, if you slide left/right, the screen cannot be stopped in the way that half of each image is visible, so I guess it's not a big canvas. Somehow you can slide screen like one big image, and yet it always lock perfectly as if they used 3 activities for this.
How did the do this?
It's a ViewPager, available in Android support package and described in their blog.
The designing is not so much difficult, As i think to draw that boxes showing quarterfinals, semifinals.
They having layout( we can do by placing image in background also).
The major role played by FrameLayout which shows you that effect(emphasis), the flages are fetch from url as matches are decided(not essentially images only names are sufficient as flags came inside app and gets applied as updated).
After your click i think the start image gets change it's just replacing that image with new one.
As you said they are not on single canvas (but if they did customization of heir Viewpager that it's not stopping in between activities), but i think it's on single canvas.
If your taking about quickness of loading and all it's up to you as much code and processing you optimized it gives you smooth feel and fast processing.
We can appreciate the work but we can not say it's too much difficult as i think it's quit easy...
Hope this explanation helps you to understand ....