late reply, but wanted to say thanks, this fixed it. On to my next problem:
I'm trying to write my own View class to handle various events, using LunarLander as an example. Here's my simple layout and class: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <com.my.package.BoardView android:id="@+id/board" android:layout_width="fill_parent" android:layout_height="fill_parent"/> <TextView android:id="@+id/TopText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="play area" /> <LinearLayout android:id="@+id/rowButtons" android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content" > <Button android:id="@+id/btnPlay" android:text="Play" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <Button android:id="@+id/btnInfo" android:text="Info" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <Button android:id="@+id/btnSetup" android:text="Setup" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> <TextView android:id="@+id/InfoText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="screen size:" /> </LinearLayout> public class BoardView extends SurfaceView { public BoardView(Context context, AttributeSet attrs) { super(context, attrs); } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { // TODO Auto-generated method stub super.onSizeChanged(w, h, oldw, oldh); TextView info = (TextView) findViewById(R.id.InfoText); //info.setText("width : " + w + ", height : " + h); } } When I first ran it, it blew up with a NPE in onSizeChanged. So at least I knew it was getting there. I commented out the info.setText line and it ran fine, but the view is blank on the screen. Why are the various TextViews and buttons not visible? I couldn't find any guidelines in the docs as to how/where to place your View class in the layout.xml. On Nov 3, 5:01 pm, Mark Murphy <[EMAIL PROTECTED]> wrote: > Brian wrote: > > I've gone through the Notepad tutorials and thought I had a grasp of > > the basics, but apparently not. I'm trying to create a screen with a > > TextView on top with a row of buttons beneath it, but only the > > TextView is displaying. The buttons are not. What am I missing? > > You have the TextView height set to fill_parent. Android makes a single > pass throughlayoutfiles, so by the time it gets to your buttons, there > is no more vertical space available. > > -- > Mark Murphy (a Commons Guy)http://commonsware.com > _The Busy Coder's Guide to Android Development_ Version 1.4 Published! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

