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

ViewSwitcher with Next and Prev Button
how to open an attachment with my applicacion from within the email app? (mime type, intent filter …)
Google Analytics V2 - IllegalStateException - can I initialize in onCreate() instead of onStart()
ANDROID open source lib to do graphics in real time
Does android has something like onDate listener?
TableLayout issue
ListPreference with Image in Live Wallpaper android (ImageListPreference)
Android Instantiation error i.e Unable to instantiate activity
Convert String to DateTime format of google APIs
How to access Assets Subfolder of installed applications in android
Profiling on Android with pg option
RSA Encryption Decryption in Android
How to dispaly a videoview in full screen in Dialog?
Android getting resource drawables in library project
What does “status -12” mean in Android AudioTrack?
Time calculation on mobile devices

Categories

HOME
google-app-engine
eclipse
jmeter
obfuscation
solaris
package
jsf-2.2
knitr
google-cloud-functions
nested-if
jetty
mapbox
tvos
jax-ws
opengl-3
nfs
g++
why3
mxgraph
opengl-es-3.0
cmdb
ipmitool
gkturnbasedmatch
frequency-distribution
docx
internationalization
google-content-api
template-engine
asp.net-mvc-viewmodel
connector
game-theory
windows-server-2003
flooding
underscore.js
intersystems-cache
winexe
bioinformatics
corenlp-server
google-cast
anki
carriage-return
hibernate-search
getlasterror
python-pptx
latitude-longitude
imagenet
sim-card
apns-php
p4merge
news
contract
flask-login
httrack
libgphoto2
opennms
configurationmanager
tinkerpop
renaming
sandcastle
smartfoxserver
jquery-jscrollpane
synonym
gogs
angular-ui-typeahead
nupic
jnlua
decimalformat
grgit
gocql
computer-architecture
.bash-profile
finalbuilder
atoi
cwrsync
alloy-ui
google-refine
osc
angular-gettext
insight.database
unix-socket
lnk
jjaql
radiant
fpdi
ecslidingviewcontroller
away3d
asdf
poker
scmmanager
mantle
sentestingkit
faye
boost-signals
inkcanvas
isa-swizzling
virtualpathprovider
strsep
cdonts
scrollbars
skype4java
web-application-project
tui

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App