android - trouble with nested layouts -
i'm beginning android , have gotten myself stuck. i've made simple app/view. idea draw line-maze in top, motion buttons on bottom. app draws x couple lines in frame, works. problem buttons being drawn far down, , clipped in height.
i assume problem in layout xml:
<?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"> <framelayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" > <none.maze.mazeview android:id="@+id/maze" android:layout_width="fill_parent" android:layout_height="fill_parent" /> <relativelayout android:layout_width="fill_parent" android:layout_height="fill_parent" > <textview android:id="@+id/text" android:text="@string/maze_layout_text_text" android:visibility="visible" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerinparent="true" android:gravity="center_horizontal" android:textcolor="#ff8888ff" android:textsize="24sp"/> </relativelayout> </framelayout> <linearlayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" > <button android:id="@+id/left" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="left" android:layout_weight="1" /> <button android:id="@+id/forward" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="forward" android:layout_weight="1" /> <button android:id="@+id/right" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="right" android:layout_weight="1" /> </linearlayout> </linearlayout>
i think shouldn't use layout_height="fill_parent"
, layout_weight
@ same time. try set layout_height="0dip"
, layout_weight="1"
framelayout
, layout_height="wrap_content"
lower linearlayout
. lower linearlayout
mustn't have layout_weight
attribute.
Comments
Post a Comment