layout代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_margin="0dip"
android:layout_weight="1">
<TextView
android:text="@string/cost_time"
android:layout_gravity="left"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"/>
<Chronometer android:id="@+id/costTime"
android:gravity="left"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="0dip"
android:layout_weight="1"/>
<TextView
android:text="@string/best_time"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="0dip"
android:layout_weight="1"/>
<TextView android:id="@+id/best_time"
android:text="@string/default_time"
android:layout_gravity="right"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"/>
</LinearLayout>
<LinearLayout android:id="@+id/puzzleview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="8">
</LinearLayout>
<LinearLayout android:id="@+id/utilbtn_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<Button android:id="@+id/undo_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/undo_button"
android:layout_weight="1"/>
<Button android:id="@+id/erase_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/erase_button"
android:layout_weight="1"/>"
</LinearLayout>
<LinearLayout android:id="@+id/num_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<Button android:id="@+id/Button1"
android:text="1"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="0dip"
android:layout_weight="1"/>
<Button android:id="@+id/Button2"
android:text="2"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="0dip"
android:layout_weight="1"/>
<Button android:id="@+id/Button3"
android:text="3"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="0dip"
android:layout_weight="1"/>
<Button android:id="@+id/Button4"
android:text="4"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="0dip"
android:layout_weight="1"/>
<Button android:id="@+id/Button5"
android:text="5"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="0dip"
android:layout_weight="1"/>
<Button android:id="@+id/Button6"
android:text="6"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="0dip"
android:layout_weight="1"/>
<Button android:id="@+id/Button7"
android:text="7"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="0dip"
android:layout_weight="1"/>
<Button android:id="@+id/Button8"
android:text="8"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="0dip"
android:layout_weight="1"/>
<Button android:id="@+id/Button9"
android:text="9"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="0dip"
android:layout_weight="1"/>
</LinearLayout></LinearLayout>
效果如下对于Android的界面设计我有的时候真是很无奈,像layout_weight属性,不管怎么修改都无法按照我的想象显示
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_margin="0dip"
android:layout_weight="1">
<TextView
android:text="@string/cost_time"
android:layout_gravity="left"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"/>
<Chronometer android:id="@+id/costTime"
android:gravity="left"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="0dip"
android:layout_weight="1"/>
<TextView
android:text="@string/best_time"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="0dip"
android:layout_weight="1"/>
<TextView android:id="@+id/best_time"
android:text="@string/default_time"
android:layout_gravity="right"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"/>
</LinearLayout>
<LinearLayout android:id="@+id/puzzleview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="8">
</LinearLayout>
<LinearLayout android:id="@+id/utilbtn_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<Button android:id="@+id/undo_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/undo_button"
android:layout_weight="1"/>
<Button android:id="@+id/erase_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/erase_button"
android:layout_weight="1"/>"
</LinearLayout>
<LinearLayout android:id="@+id/num_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<Button android:id="@+id/Button1"
android:text="1"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="0dip"
android:layout_weight="1"/>
<Button android:id="@+id/Button2"
android:text="2"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="0dip"
android:layout_weight="1"/>
<Button android:id="@+id/Button3"
android:text="3"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="0dip"
android:layout_weight="1"/>
<Button android:id="@+id/Button4"
android:text="4"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="0dip"
android:layout_weight="1"/>
<Button android:id="@+id/Button5"
android:text="5"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="0dip"
android:layout_weight="1"/>
<Button android:id="@+id/Button6"
android:text="6"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="0dip"
android:layout_weight="1"/>
<Button android:id="@+id/Button7"
android:text="7"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="0dip"
android:layout_weight="1"/>
<Button android:id="@+id/Button8"
android:text="8"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="0dip"
android:layout_weight="1"/>
<Button android:id="@+id/Button9"
android:text="9"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="0dip"
android:layout_weight="1"/>
</LinearLayout></LinearLayout>
效果如下对于Android的界面设计我有的时候真是很无奈,像layout_weight属性,不管怎么修改都无法按照我的想象显示
解决方案 »
- 我的连连看有时候没响应,能帮我看一下吗??
- 如何监听短信会话(对话)的删除
- android socket 长连接的问题
- 【求救】xml诡异报错!!!
- 问各位高手一个很丢人的小问题~
- onChange里能不能写发短息的代码?
- 开发中,sdcard路径问题
- unfortunately MyFirst has stopped 如何解决
- 关于SQLiteOpenHelper的问题
- 关于图片程序中删除图片后缩略图残留的问题!
- 百度地图API MKSearch在第一次执行时,MKSearchListener无返回值
- Unable to read workbench state. Workbench UI layout will be reset.
现在让我发现更简单的一个方法
将自定义的View那个LinearLayout的weight设置得高一些,就好了,从8增加到16