Weird layout on phone - java

So, I started learning android development recently, and after a week, I've gotten far enough to create a simple calculator. I have two problems with the layout.
First is, I wish to remove the toolbar. I tried to change the theme to one without a toolbar (NoActionBar). This works in the design view, but doesn't reflect in the emulator (AVD) or my phone.
The second and more bothersome problem is with the buttons. I used a GridLayout for a 5x4 button grid, and I use the layout_columnWeight and layout_rowWeight to ensure they are the same size across the screen. It appears nice in the design view AND in the emulator, but it looks very weird on my phone. Also, the buttons don't show any reaction animation when pressed.... Kinda like a static image.
My minimum SDK for the project is 5.0 lollipop and my phone is 5.1 lollipop.
The first attached image is the design view, and that's exactly how it looks in the emulator. The second image is a screenshot from my phone.

Related

Is there any way to get the top bar darker with dynamic colours on Android?

For some reason, after implementing Android 12/13 Dynamic Colours in my Android app, the top bar is very light and so the text that says what fragment is displaying is barely readable. Here's some screenshots:
Screenshot of the app when Android is in Light Mode
Screenshot of the app when Android is in Dark Mode
I tried researching this problem online, but I found no results on how to fix this.
Is there any way of sorting this, since this was never issue before I set up the app with Android's Dynamic Colours?

How can I use ViewPager to display apps?

As the title states, how exactly can I use ViewPager to display a list of apps. Right now I'm using a GridView to display the list of apps on my device and it runs the app upon selection. However I wish to get a similar effect from launchers in the Play Store, the app drawer is split into different views and displays a set number of apps on one page. And when you swipe it goes to the second page and displays more apps.
How can I do this? At the moment I just have a simple GridView which can be scrolled up and down,
I have looked all around the internet and i have gotten no answers, I've taken a look at the aosp launchers src on github but it's too complicated to understand.
Thank to whoever answers my question.
You can use Jake Wharton's Android-ViewPagerIndicator in ViewPager to display your content. You can also try astutez's PagerSlidingTabStrip, it will me more suitable for your requirements. Implementation is very simple, you can also find the sample in the repository.

Layout problems on Samsung Galaxy Y S5360

I am new to Android Development. I have recently developed an app that supports Screen sizes of 3" to 4"! The problem is that When I run my app on my HTC Wildfire S (3.2") it works find the screen visuals are fine to see and it gives best resolution.
But when I run the same app on my Samsung Galaxy Y S5360 (3") a small portion of the screen vanishes at the spot I mean the screen visuals are not so much visible to see and gives bad visuals of screen.
Why it is so when I have set the screen size as ranging from 3" to 4". I am using Relative Layout and in the Eclipse IDE the Screen is showing so well also.
HERE is the Eclipse IDE image
HERE is my Samsung Galaxy Y S5360 Image: sorry for poor image.
YOU can see the problem of text at the bottom of cell phone image how can i fix this? please help thanks in advance!
First- never trust the eclipse plugin. Its buggy, and its an estimation anyway. You can use it to see if you're roughly right, but never expect it to look like that ont he actual device, much less on all devices.
As for your problem- the screen on your device is too small for your layout. You either need to cut out whitespace or shrink something. If you can find out the exact resolution of this device you could make a special layout for devices of that resolution.
This is a standard problem in android UI design- you're developing for a lot of screen, some of which are very small. If you want it to work on everything, you have to be very careful with the amount of content and empty space on each screen and test against a variety of resolutions and physical sizes.
A good way to get around this is to size everything in dp. 1dp=1/160th of an inch. Then you know how big a screen you'll show on.
My 2 suggestions are as below
1.Can you try using scroll view for your content
2. apply full screen to your app & change the current layout of the app(if in case of linear layout)

Android java 2.3.3, how to create a menu like steam?

How do you make a steam like menu?
Below is a screenshot from my Samsung Galaxy S. The menu unfolds when you press the menu button on the bottom of the phone and it pushes the current window to the side and displays the menu. So it steals 70% of the screen. Question is, how is it built? I don't even know where to start building something like this. Any ideas? Tutorials?
Should be compliant with android 2.3.3.
Use Jeremy Feinstein's SlidingMenu library. It works very well and actually performs smoother than the Steam implementation of it.

libGDX Causing Multitouch Problems

I am working on a game with a virtual joystick in the bottom right corner of the screen and a "move" button in the bottom left. So you use the joystick to point the character in the right direction and press the "move" button to go forward in that direction. This was all working great until today and now when I press on the screen to go forward my joystick is being affected. I know it is not a coding problem because I haven't opened the file that handles touches for 8 days and it has been working fine. Also after I close my app and then use another app that is completely separate from libGDX the multitouch is having the same issue. So do you guys think this is a problem with libGDX, my device, or am I just not coding the multitouch correctly for libGDX? I am using a Stage and the controls are Actors on the Stage I should note that after I restart my phone, the other app that is not using libGDX works correctly. It is only after I open my libGDX based game. So frustrated with this that I am about to give up on libGDX. I am happy to post any code that is requested.
EDIT: Please see comments below. This seems to be a specific issue with the Galaxy Nexus and probably some other Samsung devices as well. This libGDX based app has had no issues on other devices such as original droid, and ASUS Transformer tablet.
Turns out this is not a libGDX problem at all... Nor was it a problem with any of my code. There seems to be a bug in the way the Galaxy Nexus handles multitouch. You can view the bug report at this link. Seems that as of 4.0.4 there still is no fix for this bug. I am still currently running a VZW Galaxy Nexus with 4.0.2, I guess all we can do is wait and put a disclaimer in our games until (if ever) it is fixed.
By locking and unlocking the device, the problem does go away (sometimes), but will quickly come back if I go to my homescreen and re-open the app.

Categories

Resources