[android-developers] Re: Adding a ViewGroup to RelativeLayout
On Friday, September 21, 2012 8:56:26 PM UTC-4, Shoaib Dar wrote:
I want a RelativeLayout that's composed of two parts: The bottom portion is an xml TableLayout file, and the top portion, which i plan to do later, will be a separate custom view.So far i tried to add the TableLayout to the RelativeLayout and am already getting an error.public class mainActivity extends Activity{RelativeLayout relativeLayout;TableLayout tableLayout;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState); relativeLayout=new RelativeLayout(this);ViewGroup vg= (ViewGroup)findViewById(R.layout.myTableLayout); RelativeLayout.LayoutParams relativeParams = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); relativeLayout.addView(vg,relativeParams); setContentView(relativeLayout); }}I feel like there is a much easier way to do this, any help?
EDIT: there is nothing wrong with the imports and/or typing mistakes, etc. I basically want to know if this is a good approach for dividing a RelativeLayout, and if i making any general logical errors above when i am adding views to RelativeLayout.
-- You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home