How to remove left Range panel in androidplot? - android

I'm trying to get the graph view horizontally centered inside my layout, but I'm not able to "remove" that left bar, which is actually where the "range" settings are.
This is a screenshot from the official demo app, showing this undesired effect which I'm also getting on my app.
Any ideas how to completely remove this?

Try:
plot.getGraphWidget().setMarginLeft(0);
That should actually get rid of everything on the left including the area where the range labels are currently being drawn so you may need to play with it to find the value that looks good with your range values / range font configuration.
Nick

Related

Design view in Android Studio scrunched to the left

Hopefully this is something simple and stupid. I am editing an existing Android app for an embedded device that communicates with Bluetooth. The manufacturer of the development kit provides the Android code so that you can edit it how you want. The device (Silabs Thunderboard Sense 2) just transfers numeric information (sensor data) from the device to the phone.
I have been able to edit the actual code to change labels and values to what I want, but now I want to rearrange/add/eliminate some buttons in the screen layout. The app generates these buttons when downloaded to the phone, but I'm unable to see them when I open the .xml files in "design view" in Android Studio. At first I thought the buttons weren't there at all, but then I noticed that there is a blue line down the left side of the sample screen. When I click on it, I get the attributes etc., but no matter what I try, I can't seem to get the button to show. I have tried pulling it, double-clicking it, right-clicking it, changing attributes...nothing works. I'm thinking that it's a setting that needs to be tweaked, but I'm afraid to just go changing everything and making it worse. Here is what it looks like:
the red circle indicates where the mysterious blue line appears.
It's like the image is scrunched to the left with no width. It should be a square image button with a small icon, a label and some live data. Any ideas?
Don
try setting the FrameLayout width policy to match_parent.
EDIT
Also check your parent LinearLayout width and height policy is `match_parent'.

Calculate margin using AccessibilityNodeInfo

I am developing an accessibility service on android and I want to check the space between on-screen elements. Currently I am already using AccessibilityNodeInfo and its getBoundsInScreen() method to read the touch target size of clicked elements.
Do you know if there is a way to retrieve the margin of an element?
There is not. Anything that you came up with would be a hack.
You could compare the on screen coordinates of elements. But, then you're not going to get a "margin" just the space between them. There is no way to get a "margin" property.

Controlling the positions of a views in Android

I am trying to create an android app where I have a single relatively big button in the middle (the light blue in the picture) and it is surrounded by other smaller buttons as shown in the picture (some of small buttons might be visible or invisible based on some criteria).
I started with the RelativLayout setting the big on in the center and making the rest placed in relation to it, but it is a miss and the central button get shifted and doesn't stay in the center. I tried placing them in FrameLayout and used margin to adjust their locations, that worked the best however, the spacing changes on different screen resolutions.
So what is the best way to achieve such layout that will look consistent on any device?
Android's Percent Support Library allows you to use proportions to lay out your views, which may allow you to get closer to your goal.
http://developer.android.com/tools/support-library/features.html#percent

How to change a view position and size at will

I am working on an Android Advertisement SDK. This SDK will charge fetch Advertisement resource and play it in a WebView.
Depending on the content of the Advertisement, the SDK need to change the WebView's position and size. For Example, A banner advertisement will palce in the top or bottom of screen, some advertisement maybe place at center, left or right.
Now I need the users to place the WebView in FrameLayout, So I could change the position and size of WebView at will and don't affect other views. I could set FrameLayout.LayoutParameters to adjust position and size.
Obviously, this is a strong restriction for users. Maybe they want use RelativeLayout and others.
So is there anyone have ideas about my issue? I am trying to use fragment now and didn't know would it work.
There is 2 approach to do this.
One is to set a layout ( forgot the name ) which allows you to set a component at custom position, size anywhere you want. As I remember it was 2 of those and one is deprecated form a version of Android. Google it those please, if you choose this method.
Other one it is with a trick:
Establish 9 positions (like the 9 pinch) and there use a predefined layout.
For eg. use a Relative layout.
1. if the banner need to be in position 1 than do x,y,z stuff - rearrange a bit the others, do what you need if is on the top left.
2. if the banner it is a "merged position" 1 and 2 from grid (a a lot wider), than you do other corrections.
and do many cases what you need.
Good luck
I have figure out this question.
Every android app is base on a FrameLayout(android.R.id.content).When I need to change position of a view. I could remove the view from its current layout and add it to FrameLayout(android.R.id.content).
That's what I want.

Android draw9patch: static area gone

I uploaded a screenshot what I'm doing: http://www.fotos-hochladen.net/uploads/bildschirmfoto0knmxp974g.png
I want the yellow area to be always the same size, whereas the transparent area at the top should scale. The problem is, that the whole image gets transparent with that configuration.
If I add another dot at the left side it works, but then the yellow area also scales...
If I understand the docs correctly, this should work as I thought.
Thanks in advance.
Try un-marking the farthest right pixel along the top edge. I'm not exactly sure why this works, though.

Categories

Resources