Thanks again for your reply, so it's the same problem I had earlier.
So how is the LunarLander Text being displayed? I tried the same
thing it does, with setTextView(), but mine still isn't being
displayed. Does it have anything to do with the enclosing Layouts,
the FrameLayout as the parent of LunarView and RelativeLayout as the
parent of the TextView? I don't understand why the layout xml is even
used this way, why not just programmatically set the LunarView with
setContentView(new LunarView()) - (yes I know it doesn't have a
default constructor, but couldn't you add one?) Soo confused...
Here's my latest:
main Activity:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.board_layout);
mBoardView = (BoardView) findViewById(R.id.board);
// give the LunarView a handle to the TextView used for
messages
mBoardView.setTextView((TextView)
findViewById(R.id.InfoText));
}
public class BoardView extends SurfaceView {
private TextView mStatusText;
public BoardView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
mStatusText.setText("width : " + w + ", height : " + h);
}
public void setTextView(TextView textView) {
mStatusText = textView;
}
}
On Nov 7, 12:28 pm, Mark Murphy <[EMAIL PROTECTED]> wrote:
> Brian wrote:
> > Why are
> > the various TextViews and buttons not visible?
>
> Because you gave the whole screen to BoardView:
>
> <com.my.package.BoardView
> android:id="@+id/board"
> android:layout_width="fill_parent"
> android:layout_height="fill_parent"/>
>
> Android takes one pass through the layout to determine sizes, and it is
> very literal with respect to instructions. So, since your first widget
> is set to take up the whole screen (fill_parent and fill_parent), your
> first widget takes up the whole screen, leaving nothing for the
> remaining widgets.
>
> --
> Mark Murphy (a Commons Guy)http://commonsware.com
>
> Android Training on the Ranch! -- Mar 16-20,
> 2009http://www.bignerdranch.com/schedule.shtml
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---