Android :: Swap Two Buttons Positions In TableLayout

Jul 21, 2010

Suppose I have the following layout

CODE:......................

How could I swap position of button01 with button02? And would it work also for swapping button01 with button05?

Before asking what I have tried so far, I don't even know where to start. I googled but the only answer I could find was about AbsoluteLayout.

Android :: Swap two buttons positions in TableLayout


Android :: Buttons In TableLayout Cropped On 1.6 And 2.1 But Not On 1.5 Or 2.2

Aug 9, 2010

I have four buttons arranged in a 2x2 TableLayout. These buttons each have an image on the left and some text. The buttons display fine in the emulator for 1.5, and for 2.2, but when testing with 1.6 the two buttons in the righthand column are cropped so that they are missing their righthand edge (the padding to the right of the text is missing and the button ends abruptly with squared off corners rather than rounded ones). There is plenty of room for the TableLayout to expand to accommodate the full width of the buttons. This happens for all screen sizes.

The layout looks like this and itself appears within a RelativeLayout:

CODE:...............

The buttons are styled as follows:

CODE:.................

I'm assuming this is a 1.6-specific bug. Has anybody else come across this problem? Any suggestions for work-arounds?

I've had the opportunity to try it with Android 2.1 (both on the emulator and a device), and the problem happens there too. So 1.5 good, 1.6 bad, 2.1 bad, 2.2 good.

View 1 Replies View Related

Android :: Buttons To Fill Width When Using TableLayout

Feb 10, 2010

I have a table having 2 rows each row having 3 buttons.How can I make the buttons to fill the space equally. In HTML I would give them 33% width.Also do you know any way I can create a view having 4 image buttons in a row as a grid layout, similar to the launcher.

View 2 Replies View Related

Android :: Possible To Align Buttons In A TableLayout To Different Directions

Apr 21, 2010

Probably I don't understand the layout properties of TableLayout yet. It doesn't seem to be possible to achieve such a flexible table like in HTML, because there are no cells. My target is it to achieve such a layout:

Link to draft

How can I do that? I thought about using a GridView but this doesn't seem to be useful in XML.
My efforts look like this....

View 2 Replies View Related

Android :: Animated Swap Position Of Two Buttons

Nov 6, 2009

I am trying to swap the position of two buttons. My swapping code looks as below.
private void exchangeButtons(Button btn1, Button btn2) {
// Create the animation set AnimationSet exchangeAnimation = new AnimationSet(true);
TranslateAnimation translate = new TranslateAnimation(Animation.RELATIVE_TO_SELF, btn2.getLeft(), Animation.RELATIVE_TO_SELF, btn1.getLeft(),
Animation.RELATIVE_TO_SELF, btn2.getRight(), Animation.RELATIVE_TO_SELF, btn1.getRight() );
translate.setDuration(500); exchangeAnimation.addAnimation(translate);
// int fromX = btn1.getLeft();
// int fromY = btn1.getRight();
// int toX = btn2.getLeft();
// int toY = btn2.getRight();

Log.d("ArrangeMe", "view1 pos:" + btn1.getLeft() + ", " +btn1.getRight() + "view2 pos:" + btn2.getLeft() + ", " + btn2.getRight());
AnimationSet exchangeAnimation1 = new AnimationSet(true);
TranslateAnimation translate1 = new TranslateAnimation(Animation.RELATIVE_TO_SELF, btn1.getLeft(), Animation.RELATIVE_TO_SELF, btn2.getLeft(),
Animation.RELATIVE_TO_SELF, btn1.getRight(), Animation.RELATIVE_TO_SELF, btn2.getRight());
translate1.setDuration(500); exchangeAnimation1.addAnimation(translate1);
// EXECUTE
btn1.startAnimation(exchangeAnimation);
btn2.startAnimation(exchangeAnimation1); }

I call the code as below:
exchangeButtons(button1, button2);
My layout looks as below:
what happens when I execute the code is, instead of the buttons exchanging their positions, they just disappear for sometime[may be 500 ms] and reappear as they were originally.

View 4 Replies View Related

Android :: Column TableLayout As Only Child Of Scroll View - TableLayout Width

Oct 30, 2010

I have a two column TableLayout as the only child of a scroll view. The first column contains TextViews ('labels') and the second column contains EditText/Spinner/DateWidget etc ('values').

Even though I have have specified android:layout_width="fill_parent" for TableLayout, TableRow & all widgets (in 'values' column).

The screen looks perfect when the activity is created. However, when one types a really long value in the EditText, the 'values' column goes beyond the visible screen area.

View 3 Replies View Related

Android :: Getting Home Screen Positions

Oct 19, 2010

My question today relates to the android home screen and where it stores icon / widget positions. Specifically, I am interested in accessing the positions and sizes of any icons that are currently being displayed. I have, so far, been unable to find a method of retrieving the positions of other applications but i figure it must be possible in some way due to the presence of third-party home screen applications. Ideally, I am hoping to query the positions of whatever is on the screen at the moment from a live wallpaper and adjust my rendering accordingly.

View 1 Replies View Related

Android :: Specifying Relative Positions In Layout?

Sep 30, 2009

I need to implement a screen containing a list of blocks one below the other. Each block will contain mutiple superimpose elements (Images, text) for which the relative position needs to be specified with respect to the top left corner of the block.

For creating the list of blocks i have used listview. For each block i tried to use relative layout.This works ok when the phone is in landscape mode and absolute position is specified relative to left edge of the phone. But when the phone is put in the portrait mode the layout gets distorted.

1) What layout can be used for this scenario?

2) Can relative positions be specified in terms of percentage of screen width/height instead of pixels?

View 3 Replies View Related

Android :: Selected Positions In A Listview

Aug 27, 2009

How can I retrieve the positions of the selected item in a multichoice listView ? The getSelectedItemPosition method returns only the first one...

View 1 Replies View Related

Android :: Aligning Components At Desired Positions

Mar 30, 2010

Seeking help to design a layout as shown here:

http://docs.google.com/Doc?docid=0AQhgDtGvE2HgZGZ6cmtua185MTd0eGdyZmc&hl=en

The major challenge I face is aligning the components at desired positions. Please refer the three buttons(icons) and the way they are positioned.

Literally, going nuts, thinking how to position those exactly at the desired places.

View 2 Replies View Related

Android :: Actualice The Positions Of The Items In A Googlemap?

Nov 18, 2010

Hi, i have a googlemap app that displays two items (itemizedoverlay class) and i have a Update button. When i press the update button, i want to remove the items from the map, and put again the same items but with the new latitude and longitude values (i have a service that actualice the latitude and longitude fields that i have in sharedPreferences, and also i recibe the other position by a bundle)

what i am doing wrong? when i try my code, the items of the map doesn't be removed.... just new items appear... but i want to remove the old ones

CODE:...........

And these are my two functions:

CODE:............

I also tryed with invalidate() on the mapview but it doesn't works... still paint the old items...

View 1 Replies View Related

Android :: Change Object Positions In Layout?

Jun 7, 2010

I'm currently working on a very simple aplication, and I intended to make it change the visual aspect depending on the screen size. The application just has 6 buttons like this:

I'm using the AbsoluteLayout, and changing the x and y of the buttons with the methods offsetLeftAndRight and offsetTopAndBottom. I'm not changing the layout of the buttons in the xml file, so the all start in the same place.

However, if I use this methods inside the onClickMethod they sometimes appear where I want them, sometimes don't (can't figure out why), but if i use them in the onCreate method, nothing happens.

View 2 Replies View Related

Android :: Advanced Gradients - Thumb Positions?

Oct 16, 2010

I am trying to create a gradient drawable to depict a ratio of something. As a general example, lets say you were looking at a listview containing a fleet of cars. The background could be a fuel gauge - I don't want a smooth, wide transition. I want a very tight transition, and I want to be able to set where that transition takes place.

Here's what I'm staring with, but I'm not getting very far.

CODE:......................

View 1 Replies View Related

Android :: Icon Image Rotate Positions In Contacts?

Jan 10, 2010

I thought it may have been my eyes, when I thought I saw an upside-down Android icon for a contact the other day, on my Android 1.5 device - Samsung Moment. I was playing with contacts just now, and I saw the upside down icon again. Then I was curious, went to see other contacts, and I noticed the Android icon facing right, then facing left in other instances. There is no rhyme or reason as to when the Android icon will change positions, but it is there.

View 1 Replies View Related

Android :: Draw Cupola Circles At Random Positions

Jun 15, 2010

I am trying to draw a cupola circles at random positions in an Android application. I draw them on a bitmap and then draw that bitmap on the canvas. This is the function where a draw the circles:

private void drawRandomCircles(int numOfCircles) {
Canvas c = new Canvas(b);
Paint cPaint = new Paint;
cPaitn.setColor(Color.RED);
for(int i = 0; i < numOfCircles; i++) {
int x = Math.Random % 100;
int y = Math.Random % 100;
c.drawCircle(x, y, 20, cPaint)
}
}

The Bitmap b is global. And after calling this function I just draw the bitmap in the onDraw method. Now the problem is that I only get one circle drawn on the screen, no matter the size of numOfCircles.

View 1 Replies View Related

Android :: Synchronize Two ListView Positions When I Scroll Any One Of Lists

Nov 24, 2010

I have two ListViews. Is there any way to synchronize the position of ListViews when I scroll any one of the Lists

View 1 Replies View Related

Android :: Display Images Dynamically On Dynamic Positions?

Sep 2, 2010

I have rectangles and images and i want to show that images on that positions that rectangle holds in it...it is all dynamic. and i am using bitmap class to display but now i have to set positions according to that rectangle...

View 1 Replies View Related

Android :: Manipulate Positions Of Background Images In ImageButton?

Jun 1, 2009

Is there a way to manipulate the positions of *background* images in an ImageButton?

View 2 Replies View Related

Android :: Google Maps & Apps With Mapview Have Different Current Positions

Jul 20, 2010

I have a mapview where I want to track the user's current location. GPS as well as 'use wireless networks' is activated in my phone settings.

Nevertheless, since I'm indoor I don't get a GPS fix, therefore the location is determined via network; wifi spot is available.

I have the Google Maps app running as well as my application running.

Strangely, the current location differes between Google Maps and my application, where the Google Maps is very accurate while in my app the location is somehow off a few 100 meters.

In my application I basically do the following (for debugging purposes now):

1) initially place one marker on the map: geopoint retrieved via locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);

2) initially place another marker on the map: geopoint retrieved via locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);

This will put the last known locations of both providers onto the map (eventually last known from outside my app).

3) then for the regular updates (since I don't get a GPS fix anyway indoor here), I do:

locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, baseLocationListener);

You can see for the frequency and distance I pass the 0 param in both cases.

In the app manifest, the following permissions are granted:

android.permission.ACCESS_COARSE_LOCATION
android.permission.ACCESS_FINE_LOCATION
android.permission.ACCESS_MOCK_LOCATION

Actually my baseLocationListener does get called, which I see in the log, but the updated location is somehow the same as the last known current position (of LocationManager.NETWORK_PROVIDER), same lat/lng.

I thought maybe I overlooked something or missed a parameter or setting, or my code has a bug. Therefore I installed some other (3 in total) LBS apps from the Android market that also show the current user's location. The current locations displayed in those apps are equals to the one in my application - and they're all some 100 meters off - but at least all the same.

See the screenshot here:

http://img33.imageshack.us/img33/8679/mapproblem.png

Now I am wondering:

1) as I understand, getLastKnowLocation is system-wide and not app-wide, why are there differences between the location in Google maps and all the other apps?

2) does Google Maps not update the lastKnownLocation of a provider?

3) does Google Maps use a different custom location provider (i.e. due to licensing reasons) other than GPS_PROVIDER or NETWORK_PROVIDER as they are in the SDK?

4) how do achieve the same accurate result with the NETWORK_PROVIDER like Google Maps does?

View 2 Replies View Related

Android : Place Controls At Absolute Positions - Custom ViewGroup

Sep 26, 2010

I have a custom ViewGroup. The idea is to be able to place controls at absolute positions and then have the ViewGroup scale those controls based on the difference in the screen dimensions with respect to the original design dimensions. I am using the code below. In response to the 'onMeasure' message, I am storing the width and height of the view. Then on the 'onLayout' message I am computing new dimensions for the child controls and adjusting their sizes proportionally. This all works to some degree. However for certain controls (e.g. button controls), the control resizes, but the text inside does not remain centered within the control. I am thinking that there is some other call I need to make to update the child controls after I change their size.

View 3 Replies View Related

Android :: Google Maps & Apps With Mapview Have Different Current Positions Options

Jul 20, 2010

It seems that the problem is in the data quality of the different map provider that are used for Google Maps and MapView in SDK, which differ.

The map tiles coordinates don't seem to be very accurate, just like in the public google maps web api / tiles.

See this screenshot for an example, where I pinned the same geo point. http://img339.imageshack.us/i/gmaps2.png/

The map using the public map api is off a few hundred meters. Seems that we just have to live with it.

CODE:................

View 2 Replies View Related

Android :: Dumped XML Layout File Padding Positions Not Behaving Correctly

Dec 30, 2009

I've been trying to figure out how to make some sense of a dumped XML layout, and it's progressing 'pretty good'. The only thing I'm currently unsure about is the following:

When I use the command:

aapt dump xmltree <pathofapk> <pathofxmlfile>

I get the following result:

CODE:.............

That's all good, but what I'm trying to figure out is how to convert the following code into the XML layout file:

CODE:.................

Converting those values to decimal would result in:

CODE:.................

All good, but I've been trying to figure out what the (type 0x5 means). With all other types, the result is defined in the Android.util.TypedValue.class file

Decompiling that, gives the following result for 0x5:

CODE:...............

Makes sense, in a way. But, I need to know what kind of value it is, so looking down, I find the following value:

CODE:.............

But, when I try to use 2561mm and 1025mm (It's a tad much anyway, 25cm is.. larger than my screen), The whole screen is filled with the 'parent LinearLayout'.

View 3 Replies View Related

Android :: Update Positions Of Items Of Mi Googlemap But They Only Get Repainted When Move Or Zoom Map

Nov 18, 2010

I actualice the positions of the items of mi googlemap but they only get repainted when i move or zoom the map...

I want that every time the possitions got updated then they get repainted on the map without having to move or zoom it with my finger

Invalidate is not the answer, because it makes a full repaint of all and needs to redownload the map from internet...

My code:..........................

View 1 Replies View Related

Android :: Placing Buttons - Place Four Buttons Near Top - Left - Bottom - Right Edge Of The Screen

Jul 29, 2009

I am not able to find out the perfect layout(viewgroup) to place four buttons as shown in the attached image. Basically, i want to place four buttons near the top/left/bottom/right edge of the screen. AbsoluteLayout helped, but it is deprecated (It is also better to avoid AbsoluteLayout as it is not very flexible for orientation changes)

View 2 Replies View Related

Android : Bug In TableLayout?

Feb 16, 2009

I think that there is possible bug in TableLayout SDK 1.0 rc2 when constructing table from code. It seams that the weight or height attribute is not respected when rendering the layout.

The XML view creates a table with row at the top and row at the bottom of the screen which is what supposed to happen, so I created this same table via code but the results are not what were expected. Maybe I am missing something but it seams OK, all LayoutParams are this same.

Sample Code ...

If anyone else can confirm this I will post this as a bug.

View 4 Replies View Related

Android :: Get All Table Row's In TableLayout

Jul 25, 2010

how to get all TableRow's in a TableLayout. I already know how to add and delete rows dynamically, but I need to loop over all the rows and selectively delete some of them. I think I can come up with a work around, but I'm trying to avoid crude hacks in my app.

View 1 Replies View Related

Android :: Add Column In Tablelayout

Oct 14, 2010

I had number of rows in my view now I want to add 2 columns for each row how to do this at runtime, I had tried but not succeed.

View 5 Replies View Related

Android :: TableLayout - Row And Column

Mar 4, 2010

I want to design a table whose first column items remain fixed when user scrolls horizontally, but should scroll when the user scrolls vertically. Similarly the first row items remain fixed when user scrolls vertically, but should scroll when the user scrolls horizontally. Can this be achieved using a TableLayout? Or is there any other combination of widgets that I could use?

View 2 Replies View Related

Android :: Cannot Set Gravity Of TableLayout To Right

Sep 26, 2010

I know there are tons of questions about this already floating around SO but I've read a bunch of them and still cannot get my 3rd column to align to the right.

CODE:........................

View 1 Replies View Related

Android :: How To Style A Tablelayout

Oct 5, 2010

How to add a boarder to a TableLayout in android, like the one below?

http://developer.android.com/images/table_layout.png

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved