我刚开发android两天,布局问题很让我困扰,因为它不像HTML一样,直接控制位置就可以,也不像图形界面开发拖拽就可以
这么多布局方式,不知道大家最长用的是什么,有什么布局技巧没。
我写了一个列表,布局怎么也搞不定,
code<?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"
android:background="#C8D0D4"
>
<ImageView android:background="@drawable/title" android:layout_width="320px" android:layout_height="40px" />
<LinearLayout
android:layout_width="300px"
android:layout_height="100px"
android:background="@drawable/menu_border"
android:orientation="horizontal"
android:layout_marginLeft="10px"
android:layout_marginRight="10px"
android:layout_marginTop="10px"
>
<ImageView android:background="@drawable/index_01" android:layout_width="wrap_content" android:layout_marginLeft="5px" android:layout_marginTop="5px"
android:layout_height="85px"
/>
<TableLayout android:layout_height="90px" android:layout_width="wrap_content">
<TableRow>
<TextView android:textSize="20px" android:layout_height="match_parent" android:layout_marginLeft="20px" android:layout_marginTop="10px" android:text="希尔顿大酒店" android:layout_width="150px" android:textColor="#000000"/>
</TableRow>
<TableRow>
<ImageButton android:layout_width="50px" android:src="@drawable/holiday" android:layout_height="wrap_content"></ImageButton>
</TableRow>
</TableLayout>
</LinearLayout>
</LinearLayout>我控制不了ImageButton的大小, 我虽然写的是50px但是它始终是第一个tablerow一样的宽度150px,请问大家,我该怎么解决这个是效果图
这么多布局方式,不知道大家最长用的是什么,有什么布局技巧没。
我写了一个列表,布局怎么也搞不定,
code<?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"
android:background="#C8D0D4"
>
<ImageView android:background="@drawable/title" android:layout_width="320px" android:layout_height="40px" />
<LinearLayout
android:layout_width="300px"
android:layout_height="100px"
android:background="@drawable/menu_border"
android:orientation="horizontal"
android:layout_marginLeft="10px"
android:layout_marginRight="10px"
android:layout_marginTop="10px"
>
<ImageView android:background="@drawable/index_01" android:layout_width="wrap_content" android:layout_marginLeft="5px" android:layout_marginTop="5px"
android:layout_height="85px"
/>
<TableLayout android:layout_height="90px" android:layout_width="wrap_content">
<TableRow>
<TextView android:textSize="20px" android:layout_height="match_parent" android:layout_marginLeft="20px" android:layout_marginTop="10px" android:text="希尔顿大酒店" android:layout_width="150px" android:textColor="#000000"/>
</TableRow>
<TableRow>
<ImageButton android:layout_width="50px" android:src="@drawable/holiday" android:layout_height="wrap_content"></ImageButton>
</TableRow>
</TableLayout>
</LinearLayout>
</LinearLayout>我控制不了ImageButton的大小, 我虽然写的是50px但是它始终是第一个tablerow一样的宽度150px,请问大家,我该怎么解决这个是效果图
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货