This week's book giveaway is in the Artificial Intelligence forum.
We're giving away four copies of Pragmatic AI and have Noah Gift on-line!
See this thread for details.
Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

How to make a sidebar with a flexible behavior over different screen sizes?  RSS feed

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using a sidebar into my android app, this app required to run on from 7' to 10' android tablets, the problem is the side bar gives me different behaviors with the different sizes, look at the following pics:

with 7':



with 10':



and that happens with either fixing the sidebar size, making it in a specific range, or giving it the freedom to fit.

and that's my XML code that i wrote to integrate the sidebar:

 
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not seeing it. Did you replace the seekbar/progress bar images in your theme with 9 patches that may not have been made correctly?
 
Muhammed Refaat
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Steve Luke wrote:I'm not seeing it. Did you replace the seekbar/progress bar images in your theme with 9 patches that may not have been made correctly?



No, i didn't do that, i have used only the default sidebar progress bar, but changed the thumb. And i'm also using an Android built-in theme called (NoTitleBar)
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Still not seeing it. Can you post light_dimmingbg and light_sliderhandle images - in xxhdpi if you have it. What version of Android are you putting it on? Are you running it on an emulator and seeing the problem, or only in the layout builder?

Can you also post the entire layout - cleaning out any of the non-needed bits, so I can just copy what you have and put it in my system to see how it works (without having to guess about what layout is containing the outermost LinearLayout)?
 
Muhammed Refaat
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Steve Luke wrote:Still not seeing it. Can you post light_dimmingbg and light_sliderhandle images - in xxhdpi if you have it. What version of Android are you putting it on? Are you running it on an emulator and seeing the problem, or only in the layout builder?

Can you also post the entire layout - cleaning out any of the non-needed bits, so I can just copy what you have and put it in my system to see how it works (without having to guess about what layout is containing the outermost LinearLayout)?



light_dimmingbg:


light_sliderhandle:



and running on API 14 as min sdk, and the target sdk is API 18

And this problem is in the layout builder as i use it to view my work on different sizes.
thanks.
 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have not been able to reproduce the problem. do you have scaled versions of the thumbnail image for different screen densities? If so, what sizes do you have and what are the dimensions of the button.

The closest I was able to come to reproducing the problem was if I had an image that was much too large in some densities, and much too low in others. For example, if you take the image you provided and assume it is XXHDPI (as I had asked for) then the image is a bit small, and is smaller than 13dp on XXHDPI (on XXHDPI, 13dp is 39 pixels, the image is 29 pixels). This sort of looked like the image you have for the 10 inch display, but not quite as extreme.

I wasn't able to reproduce the display issue you have on the 7 inch display.

I assume, now, that the problem isn't with the part of the layout you sent, but rather the rest of the layout stealing or giving room, and the seekbar fills or contracts with the excess space. For example, if I put layouts above and below the group you posted and then made the layouts larger and smaller, then I could mirror the problem you have exactly. you should use a defined size (in dp) for this component [edit: rather than using layout_weight] so the component's 9patch doesn't expand or contract with space [edit: but maintains a consistent physical size]. This may mean you need to adjust the rest of the layout to fit.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!