Android layout positioning different in UI designer than on device - General Questions and Answers

This is the first time I am trying: background image covers entire screen. (nice layout delivered to me)
I am placing invisible buttons over the background image to add functionality.
When in design view or layout validator things are in position I want.
However when I run the emulator or deploy to device the buttons shift further down than designed. It seems buttons/items further down the page are shifted more than those at the top (maybe a clue). Seems like a scaling issue but since new to me need a hint. I have the layout designer set to the proper device. I have starting orientation as portrait.
I tried RelativeLayout and ConstraintLayout (same behavior)
I tried placing background image as ImageView with match-parent AND also as android:background on the layout element. (same behavior)
I am fragments and using the following attributes for all buttons (relative to the layout element/the container)
app:layout_constraintStart_toStartOf="@+id/main_fragment"
app:layout_constraintTop_toTopOf="@+id/main_fragment" />
The source file for the background image is not 1024x600 so guess one can say it is being stretched to fit. (not sure if this matters)
Regardless: I need to understand why what I design is not what I get?????
All I want is a fixed screen where nothing ever moves or resizes. I have specific target device 1024x600 mdpi tablet. This seems to be the same as the generic 7" WSVGA tablet that comes in android studio. I tried that and a custom 1024x600 device. (same behavior)
The table specs are: 1024x600 pixels 160dpi (mdpi)
What am I doing wrong? Where is there a tutorial or other help related to this?
THANK YOU!

Related

[Q] Android porting, widgets are all black.

My situation the same as that another man in the following post has.
(I am new and unable to embed outside URL's in my post. Please search Google for 'when switch to 32 bit graphics icons go black'.)
I am porting Android to a MIPS-based device. After modifying the frame buffer and gralloc, the wallpaper is displayed in the correct colours. But all widgets are black.
Since the frame buffer's post() function just received composed data, and the wallpaper's colour is correct, I guess the code that draws widgets has some problems. This may be the display data I set is different (or wrong) from what the code expects.
If it is not too much trouble, could you give me any hint about the files I should check? Or which files are related to drawing widgets?
I have spent a few days debugging this but there was no progress.

[Wallpaper][V9] JellyBeans GLES2 3D -manyFeatures- highly customizable

Updates:
Version 13 28.10.2012:
-Many new features added on htc evo 3d version
-neverending road, drag to drive
-big 3d analog clock
-timeshift-displacement lava-like shader material
-Sterescopic suport, red-green, s3d and normal mode
-...
Version 9 10.10.2012:
-Faster Rendering for all Objects
-Changed to old fluid colors
Version 8 07.10.2012:
loading custom obj files!
Load any 3D-Mesh to your 3D live wallpaper!
Just place "beammeup.obj" on sd root and activate loading from settings.
Try with attached exampes.
News: New HTC-evo-3D stereoscopic Version in new thread...
obj-import will work for both versions soon:
http://forum.xda-developers.com/showthread.php?t=1904203
Version 7 25.09.2012:
saved some cpu-power, reworked internal framerate-and sensordelay, re-balanced Color Fluid Surface-Particles, fixed a bug of previous Versions not showing 3D-Andoid if active alone.
Version 6 25.09.2012:
HTC-Evo-3D Stereoscopic Flying Particle added in landscape and portrait
Version 5 25.09.2012:
-HTC-Evo-3D Stereoscopic 3D Mode supported in landscape and portrait with auto switchig orientation. Use with "Jmz 3D Switcher". 3D-Mode can be used with other Objects. It has one build-in Image yet and can load custom, pre-interlaced in devices resolution. Will add sterescopic support for 3D-Objects like the Android and loading custom obj´s. Also particles flying into your head...
-Optimized color fluid and beta-particles a little and rebalanced the connection between both so activate both and test.
-I forgot to disable multisampling on Version 4 so it is the only version with multisampling. It will not run on devices without ms. Also it looks a little better and runs a little slower. This is was only Version 4, "fixed" on Version 5...
Fix Version 4 24.09.2012: Path to not-cropped Image will be saved since this version, so selected Image will come up after reboot or resetting wallpaper. If image is not avilible because sdcard is not mounted yet after reboot, backup tex will be used until sdcard is mounted. If Image is renamed or deleted, also backup tex will be used until you set another image or restore missing file. So all Settings should work fine now.
Note: Framerate and Sensorspeed are tweaked to 100% to give you a very smooth first run, until you touch the framerate slider first time.
I can't stop touching my phone!
BIG UPDATE Liquid Version 3 23.09.2012:
So much new stuff: New Objects, New Features, New artworks, New Settings, many Fixes and Changes, improved stability.
New Objects:
-The amazing Color Fluid Surface(including; Liquid Colors, Anti-Color, Particles, a swimming Object, Connections to other Objects, own new sub-section in Settings)
-Full Screen Image(just shifting a little with homescreen)
-New Liquid Beta-Particles (linked to the Fluid Surface to make 2 fluid physics engines connected driving each other!)
-The amazing Color Fluid Surface:
Get a realy liquid screen.
Make fine colorfull swhirls with each finger or mix the whole fluid witch all touch points.
Continuously auto-selecting the "next most-amazing color" for each touch point.
See the colors mixing transparent on any background.
Finger 4 will dropp Anti-Color, the mathematical opposite of Color. Anti-Color and Color will be colorfull neutralized against each other. Naturally Anti-Color is invisible but I found a way to show it. It´s enabled on default and will change to it´s naturally invisibility if switching to "Inverse Fluid Colors".
The Engine has it´s "own" swimming Particles and a swimming customizable Object.
Some Objects are connected to the fluid and will swimm in fluid and/or add forces to it.
The Fluid Particles are very fine and have some options, you can select an independent build-in texture to keep them look Particle-like while using any Picture on other Objects.
Fluid Surface code is great but calculated on cpu and needs power at higher fluid resolution. This needs some optimizations, I will try to move some expensive calculations to faster scripts or buffer-array-operations to make it run faster at higher resolutions. Rendering fluid is already fast.
-Static Background Picture. It´s just shifting a little with homescreen. If you select a not-transparent Picture, background will hide the 3D-Android and the 3D-Background Particles, so don't forget to disable hidden Objects to safe power.
-New Liquid Beta-Particles.
Interesting dynamic physics. Connected to Fluid Surface, if active together, engines will move each other, result will move very dynamic or chaotic.
Beta because unoptimized, slow, cpu draining, laggy touch and unstable physics could force close somtimes because moving out of bounds. But It can blast the Fluid
-New Image Artworks all supporting Transparency:
If you want to use old removed Images, you can extract the Images from old apk file.
-New Settings. Added icons to most options. Select Picture direct from Image-Buttons.
As simple and friendly as possible.
Linked gravity-sensor-delay to framerate slider to make it fast or power-saving together.
Added info and contact button linked to this thread(nothing else online yet).
Wallpaper runs fine without sdcard now. Just Cropping Image is not possible without sdcard reasonable.
- Build on Android 4.1.-, minimum required Android 2.2.
Runs Best on 4.1 with "additional features" and best stability. Settings Icons will not be visible on older Androids than 2.3.3 if I am right.
Runs on every phone and virtual device I tested. Also it runs on my TegravII Tablet on Android x86 4.0 R2 but only the 3D-Android is shown and changing Picture works but everything else not. So I will try to get it running complete on not fully compatible Android x86 later.
-Bugs: Nothing is realy broken for me. For left bugs seems just trying again makes it fine.
Loading or Cropping Pictures could still fail on bigger images or incompatible formats. I will rework the image handling a little softer to make this stable. Unfortunately Wallpaper can force close on first start in some cases.
This was next step to get everything ready for more interesting stuff.
Please send some feedback after testing.
______________________________________________________
______________________________________________________
Version 2 28.08.2012:
-New Version Build on Android 4.1.(V1 was build on Android 2.2)
-Fixed a Cropping Bug(should run more stable on most devices)
-Added Settings and Wallpaper Picker Icon, Picker can be launched after Setup
-Some Changes on loading Settings, Settings can be used before setting Wallpaper now
-This Update should fix most bugs and enable new UI in Settings!
Wallpaper Description:
Highly customizable by loading Images to interacitve Objects on fast GLES2 (OpenGL ES 2.X) Engine.
MainFeatures:
-Load any Image from Gallery to any interactive object! (supporting jpg and png with transparency)
-Load any Image cropped from Gallery to any interactive object! (supporting jpg and png without transparency)
-Fast GLES2 Engine! -Multitouch -Gravity-Sensor
-Transparency on all objects (if transparent png used)
-5 included Example Images with transparency
-Many Settings
Objects:
-Big multitouch Layer in foreground supporting G-Sensor
-Background 3D-Particles floating and rotating on Home-Screen-Shift
-High-Quality Particle System, dropping Particles from all touch-points to Gravity-Direction. Particles are rotating and random glittering when dying.
-The Bouncing Object. Elastic, downfalling, touchable, could be anything depending on the picture you select. This can get knot, you can unknot by throwing around or resetting by hiding Wallpaper(opening an app or turning display off and on will reset physics)
-The 3D-Android. Mustsee! Smooth, high Quality 3D Object with fine Mapping your Image. Rotating on Homescreen Shift and Gravity-Sensor.
Engine/App Features:
-required Android 2.2. <-> 4.1 compatible.
-Superfast GLES2 Engine on low CPU Power. Everything is displayed via optimized Shaderscripts on the GPU Buffer.
-Adjustable Framerate. Depending on Device Speed and selected Objects you can save Power by slowing down Framerate. Best result shold be about 90% with a little delay. At 100 % it will run without delay, should be no problem but not required.
-Low CPU-Power at all. Worst case with all Objects active and 100% Framerate(no delay) it consumes only about 30% CPU Power on my Evo 3D.
-Wallpaper only needs Power if visible. Propper freeing all recources and unregistering sensors if invisible.
-Settings Launcher in Notification Bar.(could be toggled in settings)
-Can be moved to sdcard in app menu
-I will implement much more (ai talking to you, more Physics, 3D-Wallpaper-Designer-App, obj-Importer,Kinect-Scan-Importer...)
Premissions:
Change/Delete External Storage. Neede to save the cropped Image.
Loading From Galery Info:
Without cropping only a link will made to load the original Image. Loading linked Image can fail! Chance to fail is higher on larger images. Also re-initialising after sucsessfull load can fail. Also speed will slow down if using big images. No Problems on smaller images, great for loading png icons with transparency. Ideal size is 512x512 Pixels (Image will be used direct as gl texture without resizing). After rebooting Device link to Image could get lost and backup tex will be loaded. Please select Image again.
By Cropping a resized 512x512 Version is saved on sdcard/jbGLESIIwallpaper/curbg.png. You can replace this Image with a transparent png for example and it should come up if you select cropped from Gallery without finishing cropping(that would overwrite the replaced)
This should work without Problems. Cropping Pictures could fail. Try again, this should bring up any jpg or png.
BUGS!!!
-Please set Wallpaper before launching Settings!!! Launching Settings before setting Wallpaper can drive you into strange Behaviours*.
-Wallpaper needs SD-Card! Wallpaper should run without sd but needs sd to start, to launch setting and to bring up custom images. If custom image is selected, wp should use backup Image and load your selected if sd is mounted again.
-Selecting Images from Gallery can fail. Please try again or try cropped.
-Selecting Images from Gallery can crash the Wallpaper or get into strange Behaviours*.
-It is only tested on my Evo [email protected], a Xperia [email protected] and some emulator images. It works on the SDK-Emulators GPU-Emulation (faster as suspected). Loading the Image as GLESII Texture needs the GPU to support the pixels format, this may fail on some devices or drivers.
-Wallpaper will start on default settings after rebooting device, setting another Wallpaper, crashing or re-installing, but your Settings are saved and will be restored if launching Settings Menu.
*strange Behaviours: waiting, staying black, force close, not opening settings, text in settings broken, asking for superuser premissions.
If you get into strange Behaviours please kill the app from app menu and try again. Everything will work fine!
a bug-free version would have not all the features yet. I am very sorry for any Problem and except everyone will be able to get it running fine.
I hope someone will have fun with it! I like it. I coded this using many open sources. It is just the beginning, to get the engine perfect with all features I want. This will be much more soon.
Downloads:
looks pretty sweet. Nice job. Will report any bugs I find.
Update Version 2 28.08.2012: Must Bugs fixed, 4.1 build
Updates:
Version 2 28.08.2012:
-New Version Build on Android 4.1.(V1 was build on Android 2.2)
-Fixed a Cropping Bug(should run more stable on most devices)
-Added Settings and Wallpaper Picker Icon, Picker can be launched after Setup
-Some Changes on loading Settings, Settings can be used before setting Wallpaper now
-This Update should fix most bugs and enable new UI in Settings!
Looks cool, gonna try
Sent from my SGH-T989 with Cyanogenmod 10 Alpha Power.
Great wallpaper! I loved it!
Sent from my PC36100 using xda premium
Da_Rock_1119 said:
Great wallpaper! I loved it!
Sent from my PC36100 using xda premium
Click to expand...
Click to collapse
Happy to hear that after all that work(continued)!
Thanks for first feedback!
@All: I have an urgent project and hollydays next week so updates will be small or after that (I can edit and build project on phone, so maybe I find some time at the beach
Version 3: Can't stop touching my phone!
Updates:
Can't stop touching my phone!
BIG UPDATE Liquid Version 3 22.09.2012:
So much new stuff: New Objects, New Features, New artworks, New Settings, many Fixes and Changes, improved stability.
New Objects:
-The amazing Color Fluid Surface(including; Liquid Colors, Anti-Color, Particles, a swimming Object, Connections to other Objects, own new sub-section in Settings)
-Full Screen Image(just shifting a little with homescreen)
-New Liquid Beta-Particles (linked to the Fluid Surface to make 2 fluid physics engines connected driving each other!)
-The amazing Color Fluid Surface:
Get a realy liquid screen.
Make fine colorfull swhirls with each finger or mix the whole fluid witch all touch points.
Continuously auto-selecting the "next most-amazing color" for each touch point.
See the colors mixing transparent on any background.
Finger 4 will dropp Anti-Color, the mathematical opposite of Color. Anti-Color and Color will be colorfull neutralized against each other. Naturally Anti-Color is invisible but I found a way to show it. It´s enabled on default and will change to it´s naturally invisibility if switching to "Inverse Fluid Colors".
The Engine has it´s "own" swimming Particles and a swimming customizable Object.
Some Objects are connected to the fluid and will swimm in fluid and/or add forces to it.
The Fluid Particles are very fine and have some options, you can select an independent build-in texture to keep them look Particle-like while using any Picture on other Objects.
Fluid Surface code is great but calculated on cpu and needs power at higher fluid resolution. This needs some optimizations, I will try to move some expensive calculations to faster scripts or buffer-array-operations to make it run faster at higher resolutions. Rendering fluid is already fast.
-Static Background Picture. It´s just shifting a little with homescreen. If you select a not-transparent Picture, background will hide the 3D-Android and the 3D-Background Particles, so don't forget to disable hidden Objects to safe power.
-New Liquid Beta-Particles.
Interesting dynamic physics. Connected to Fluid Surface, if active together, engines will move each other, result will move very dynamic or chaotic.
Beta because unoptimized, slow, cpu draining, laggy touch and unstable physics could force close somtimes because moving out of bounds. But It can blast the Fluid
-New Image Artworks all supporting Transparency:
If you want to use old removed Images, you can extract the Images from old apk file.
-New Settings. Added icons to most options. Select Picture direct from Image-Buttons.
As simple and friendly as possible.
Linked gravity-sensor-delay to framerate slider to make it fast or power-saving together.
Added info and contact button linked to this thread(nothing else online yet).
Wallpaper runs fine without sdcard now. Just Cropping Image is not possible without sdcard reasonable.
- Build on Android 4.1.-, minimum required Android 2.2.
Runs Best on 4.1 with "additional features" and best stability. Settings Icons will not be visible on older Androids than 2.3.3 if I am right.
Runs on every phone and virtual device I tested. Also it runs on my TegravII Tablet on Android x86 4.0 R2 but only the 3D-Android is shown and changing Picture works but everything else not. So I will try to get it running complete on not fully compatible Android x86 later.
-Bugs: Nothing is realy broken for me. For left bugs seems just trying again makes it fine.
Loading or Cropping Pictures could still fail on bigger images or incompatible formats. I will rework the image handling a little softer to make this stable. Unfortunately Wallpaper can force close on first start in some cases.
This was next step to get everything ready for more interesting stuff.
Please send some feedback after testing.
Fix Version 4 24.09.2012: Path to not-cropped Image will be saved
Updates:
Fix Version 4 24.09.2012: Path to not-cropped Image will be saved since this version, so selected Image will come up after reboot or resetting wallpaper. If image is not avilible because sdcard is not mounted yet after reboot, backup tex will be used until sdcard is mounted. If Image is renamed or deleted, also backup tex will be used until you set another image or restore missing file.
So all Settings should work fine now.
Note: Framerate and Sensorspeed are tweaked to 100% to give you a very smooth first run, until you touch the framerate slider first time.
Version 5: HTC-Evo-3D Stereoscopic 3D Mode supported and some fixes
Version 5 25.09.2012:
-HTC-Evo-3D Stereoscopic 3D Mode supported in landscape and portrait with auto switchig orientation. Use with "Jmz 3D Switcher". 3D-Mode can be used with other Objects. It has one build-in Image yet and can load custom, pre-interlaced in devices resolution. Will add sterescopic support for 3D-Objects like the Android and loading custom obj´s. Also particles flying into your head...
-Optimized color fluid and beta-particles a little and rebalanced the connection between both so activate both and test.
-I forgot to disable multisampling on Version 4 so it is the only version with multisampling. It will not run on devices without ms. Also it looks a little better and runs a little slower. This is was only Version 4, "fixed" on Version 5...
very nice, thank so much
Update:
Version 6 25.09.2012:
HTC-Evo-3D Stereoscopic Flying Particle added in landscape and portrait
Update:
Version 7 25.09.2012:
saved some cpu-power, reworked internal framerate-and sensordelay, balanced Color Fluid Surface-Particles, fixed a bug of previous Versions not showing 3D-Andoid if active alone.
News: New HTC-evo-3D stereoscopic Version in new thread...
obj-import will work for both versions soon:
http://forum.xda-developers.com/showthread.php?t=1904203
Update: obj-import: Load any 3D mesh to wallpaper.
Update:
Version 8 07.10.2012:
loading custom obj files!
Load any 3D-Mesh to your 3D live wallpaper!
Just place "beammeup.obj" on sd root and activate loading from settings.
Try with attached exampes.
Update: V9: Performance
-Faster Rendering for all Objects
-Changed back to old fluid colors
Update: Version 13 28.10.2012: many new features
-Many new features added on htc evo 3d version
-neverending road, drag to drive
-big 3d analog clock
-timeshift-displacement lava-like shader material
-Sterescopic suport, red-green, s3d and normal mode
-...

[Q] default system caret/cursor width adjustment

okay... lets do this.
phone : galaxy s4
problem : standard default blinking cursor is too thin (cannot see it and it makes me want to put the phone in a blender)
solution : increase the cursor width by 2 - 3 pixels.
questions : Is the cursor width determined by one file, and then is it a constant regardless of application unless the application specifically decides to change it otherwise? if so : Which file generates the cursor, and, where is this file, and where in this file is the width set?
possible exceptions : themes or launchers which increase cursor width across board...
Did I look? I searched diligently through the internet even looking into how to do it at the unix and linux level and basically... I'm either retarded, or nobody else has done this. (or both)
thanks,
-s

Mirror system screen on Android

Is it possible to mirror the the rendered display/screen at OS level horizontally or vertically?
To be clear: I do not intend to rotate or transmit/cast a display content. I rather like to have a mirror image replacing the original one, being like a reflection of physical planar mirror.
The resulting screen should be application agnostic and allow any animations etc.
youtube.com/watch?v=JWpIYM5EIJk [exactly like this but in android]
Potential use cases: Projection of an image over a reflecting surface. Imagine a Head-up display on a car pane/windshield or a Head-mounted display with mirrors.
I already checked
/system/build.prop: allows density settings and rotation modifications.
View.setScaleX(-1f): scaling views

How can you make an app believe, that a tablet is a smartphone (with root)

Hello,
I am visually impaired and I want to use a tablet as a phone, because everything looks bigger on a big screen.
But some apps look different on a tablet than on a smartphone.
They show more content on one screen if you use a tablet than if you use a smartphone.
If you then set large fonts and an enlarged display, elements overlap in the display.
Is it possible to use a tablet as a phone and make the app believe, that it is a smartphone when it is a tablet?
My smartphone is rootet and I have already tried some things.
I have changed ro.build.characteristics=tablet to "phone" (build.prop)
But that did not help.
Andreas
Change DPI. Lower means bigger. You can adjust that in developer settings, in the "smallest width". Play with that number until you find the good value. Keep in mind, every restart will reset that value to default.
Note that the Android's window size and the device's screen size are not the same. . For example, the area within the window that is used by an app can change if the window becomes too big to fit on the screen.
Read here:
Android: How to use "adb shell wm" to simulate other devices
So I bought a Nexus 10 for development and was super excited by the prospect of being able to simulate other devices using the "adb shell wm" command, with its size, density, and overscan subcomman...
stackoverflow.com
BTW:
Smartphones usually have a screen measuring between 3.5 – 4.3 inches. The screens of tablets measure between 7 – 10.5 inches, they look like a large smartphone but with additional capabilities
xXx yYy said:
Smartphones usually have a screen measuring between 3.5 – 4.3 inches. The screens of tablets measure between 7 – 10.5 inches, they look like a large smartphone but with additional capabilities
Click to expand...
Click to collapse
That is right. Tablets look like a large smartphone. The screen of my tablet has three times the space of the screen of my smartphone. This could mean, that everything is three times as big as on my smartphone. But that is unfortunately not the case.
If you then set large fonts and an enlarged display, elements overlap on the display.
I would like to have a tablet, that behaves identical to a smartphone and everything on the screen looks exactly like on the smartphone, only three times as big.
The tablet knows the physical size of the screen. Otherwise it would not know the ppi-Value. Does anybody know in which file this information is?
Maybe the tablet knows the physical size of its screen ( screen size ), but that's absolutely not of any interest in your case: it's Android's window size ( viewpoint - resolution ) what matters.
You have to find the suitable combo of PPI related to resoulution ( window size ). Both values
wm size
wm density
can get set in Android's system file
/data/data/com.android.providers.settings/databases/settings.db
what is a SQL database

Categories

Resources