方法: http: //i49.tinypic.com/352lxdt.png 方法:http://i45.tinypic.com/bahc1.png
XMLおよびコードを介してこれを行う方法。私はRelativeLayoutを使用しています。また、APIレベル8(android 2.3以降)が必要です。したがって、setWidth()、setHeight()ヘルプを使用することはできません。
方法: http: //i49.tinypic.com/352lxdt.png 方法:http://i45.tinypic.com/bahc1.png
XMLおよびコードを介してこれを行う方法。私はRelativeLayoutを使用しています。また、APIレベル8(android 2.3以降)が必要です。したがって、setWidth()、setHeight()ヘルプを使用することはできません。
重みの合計を持つLinearLayoutでRelativeLayoutをラップして、RelativeLayoutに必要な重みを与えてみてください。例:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="2" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="@android:color/black"
android:scaleType="fitXY" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
</LinearLayout>