Set android:layout_gravity from code ??

by pawan nimje » Sun, 16 May 2010 02:22:24 GMT


Sponsored Links
 Hi All once again,

In xml we have android:layout_gravity ...

how can i set this for any view [say image button] ... from code ... plz
help ...any kind if suggestion will do ..

code:

ibMap = new ImageButton(getApplicationContext());

ibMap.setLayoutParams(new LayoutParams(width,height));

ibMap.setBackgroundResource(resId);

now i want to set the android:layout_gravity from code ...

--



Set android:layout_gravity from code ??

by TreKing » Sun, 16 May 2010 08:07:14 GMT


 




Step 1: Try searching the documentation for "layout gravity".

-------------------------------------------------------------------------------------------------
TreKing - Chicago transit tracking app for Android-powered devices
 http://sites.google.com/site/rezmobileapps/treking 

--


Sponsored Links


Set android:layout_gravity from code ??

by Second Dancer » Mon, 17 May 2010 10:52:36 GMT


 LayoutParams provides that

2010/5/16 TreKing <treking...@gmail.com>



>



Set android:layout_gravity from code ??

by murmeister » Mon, 28 Jun 2010 23:24:41 GMT


 Here's what you are looking for:

ibMap.setGravity(android.view.Gravity.RIGHT);

The constants defined in android.view.Gravity mimic the names you're
used to seeing in the XML tags.

Good luck.



>



Other Threads

1. How to translate the accelerometer values from the device coordinates to the world coordinates?

I'm trying to translate the accelerometer values from the device
coordinates to the world coordinates. It's not clear how to do this.
I guess getRotationMatrix method can do sth about this,but I am not
sure how to use.
Any help would be appreciated.

-- 

2. GpsNetInitiatedHandler?

Hi all,

What is a responsibility of a java class GpsNetInitiatedHandler?
http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=location/java/com/android/internal/location/GpsNetInitiatedHandler.java;

Especially, the code near line 158.
I found also NetInitiatedActivity - a java class asking a user for
permission and file: gps_ni.h.

Regards
Antoni Jakubiak


-- 

3. Samsung launches the new Samsung phone Samsung Wave S8500 Wave

4. Http transfer-encoding chunked with gzip

5. TextToSpeech.synthesizeToFile, save wav to internal memory?

6. Launch application from homescreen with a button

7. Using <merge> with multiple ImageView s