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属性,不管怎么修改都无法按照我的想象显示
解决方案 »
- 最近想做一个像facebook的侧边栏,但是刷新页面的功能无法实现
- android中ts流文件格式
- android系统默认的发送短信功能可否返回一个发送结果?
- 做手游的同行们,你们工资是多少?
- android4.2.2 下按返回键 到某个Activity时总是会执行onCreate?
- 关于安卓即时通讯技术方向
- String比较大小问题
- 在widget点击了按钮,怎么后台刷新Activity
- 怎么继续提高自己的android水平
- AutoCompleteTextView 怎么实现点击内容回填ID
- 百度地图API MKSearch在第一次执行时,MKSearchListener无返回值
- Unable to read workbench state. Workbench UI layout will be reset.
现在让我发现更简单的一个方法
将自定义的View那个LinearLayout的weight设置得高一些,就好了,从8增加到16