我想在XML来实现显示半帧布局和半网格布局,而不通过自己与dp
这里指定它是什么,我想:如何制作线性布局半框布局和半格布局?
<?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" >
<FrameLayout
android:id="@+id/top"
android:layout_width="match_parent"
android:layout_height="250dp"
android:background="#FFFF00"
android:layout_weight="0"
android:orientation="vertical" >
</FrameLayout>
<GridView
android:id="@+id/buttom"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:numColumns="3" >
</GridView>
</LinearLayout>
我不想这个指定大小:
android:layout_height="250dp"
因为我需要重新创建这个xml的所有尺寸。也许我可以改变一些东西,Android会计算所有尺寸?
谢谢。
你应该使用'Android的指定weight属性:layout_weight' – thepoosh
给电网和框架布局相同的重量。 – Urban
这是一个Java的问题...? – Bhavin