android


Android: nine-patch is centered on one device, but moves somewhat to the right on another


I have a nine-patch image I put on a the background of a full-screen view:
And it looks as I want it on 800x480 and 1280x720 screens: it is has some equal transparent space on left and right sides. But on the FullHD screen the clear space on the left side is twice bigger than the space on the right side. But I have only one black pixel on both sides, so the clear spaces should be equal.
Then I modified my image like this:
And now it looks centered on FullHD screen, but moved to the right on 800x480. How can I make it look centered on all the devices?
Now first image looks like this on FullHD device (this is the bottom part of the view):
and the second:
and they look vice-versa on 800x480 device.
The layout is as simple as this:
ImageView ib = new ImageView(this);
ib.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
ib.setBackgroundResource(R.drawable.scroll_both_ver);
setContentView(ib);
Upd: The solution was to provide a copy in each of drawable-* folders.
Your 9 patch top center black area is not centered well, it has more space on the right than on the left. Not sure how this can explain your problem, but try to adjust it

Related Links

Chrome Custom Tabs - Load text/String
how can i encrypt a mp3 file and decrypt and use it?
Add a textview below recyclerview in drawer layout
TextView with colored font [duplicate]
How to open skype application from ionic v2 app
Locked out of android tablet and volume button broken
using firebase to user signup activity in android
Text in android button is being cut
Location finder along with updates using google map v2
how to receive custom Uevent from kernel in android application
How to connect Android App to AWS Database
Creating Android 2.2 on Eclipse Neon
how to check intent image selected for upload in android
Unable start activity Unable to start activity ComponentInfo in Recyclerview
JobDispatcher.cancel() is not calling onStopJob()
Retrofit ignores query parameter

Categories

HOME
shell
microsoftgraph
fuelux
case
jmx
pascal
r-googlesheets
google-cloud-functions
3d-reconstruction
onclick
settings
missing-data
azure-container-service
gluon-mobile
arangodb
openpyxl
heap
project-intu
filechannel
openbugs
stellar.js
plink
magnetic-cards
selectize.js
cumulocity
docx
mongodb-csharp
azure-iot-hub
entitymanager
template-engine
swagger-2.0
imageresizer
has-and-belongs-to-many
android-maps
fractions
tizen-tv
finagle
database-comparison
playstation-portable
hreflang
baidu-map
sharepoint-workflow
graphhopper
connection-pool
ods
subclipse
print-css
ssrs-2014
drupal-theming
strftime
ovf
spring-data-couchbase
opengl-4
edit
bootstrap-tags-input
google-cloud-console
jclouds
clipboard.js
jtwig
qiime
mediametadataretriever
spreadjs
mobiledoc-kit
crouton-os
toran-proxy
sha512
nsurlsessiondatatask
entity-framework-4.3
zend-currency
openbabel
execve
iiop
android-vibration
device-tree
mdichild
jqmodal
cuba
jquery-slider
fpdi
vbe
gtm-oauth2
breakout
mbunit
process-explorer
facebook-timeline
monotouch.dialog
vfs
pyunit
fusefabric
infobright
pinch
matlab-load
svk
luajava
timertask
isapi-extension
application-verifier
duplex
lxr

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App