• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Android view to be centered dynamically in an activity

nag01758

Lurker
How can one center align a view on a mobile screen in a complex activity programmatically without knowing the actual layout structure?

Lets say I have an activity layout like this...

<CUSTOMFRAMELAYOUT> //referring to a class extending FRAMELAYOUT
< LINEARLAYOUT-1>
<FRAMELAYOUT-1>
<LINEARLAYOUT-2>
<TEXTVIEW-1/>
</LINEARLAYOUT-2>
</FRAMELAYOUT-1>
<FRAMELAYOUT-2>
</FRAMELAYOUT-2>
</LINEARLAYOUT-1>
</CUSTOMFRAMELAYOUT>

Now without knowing how the layout is defined, I want to remove 'TEXTVIEW-1' from its existing position and want to center it to the root layout

... in this case, the root layout is < CUSTOMFRAMELAYOUT>
 
Back
Top Bottom