線形レイアウトを使用して相対レイアウト内にイメージビューを表示しています。私はすべての画面の種類の間にスペースを入れずに、画像の幅が画面の横幅に占めるように見えるようにします。 しかし、私はまだビューの間に不要なスペースを取得します。私はこれについて助けが必要です。線形レイアウトの項目が画面に正しく適合しない
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/back_main"
tools:context="com.example.MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1"
android:layout_alignParentBottom="true">
<ImageView
android:layout_width="wrap_content"
android:layout_height="56dp"
android:layout_weight="0.25"
android:src="@drawable/img_audio"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="56dp"
android:layout_weight="0.25"
android:src="@drawable/img_event"/>
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="56dp"
android:layout_weight="0.25"
android:src="@drawable/img_video" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="56dp"
android:layout_weight="0.25"
android:src="@drawable/img_more"/>
</LinearLayout>
</RelativeLayout>
画像を画面の水平方向に配置しますか? –
ええ。それは幅を埋めるdoesntnt – Chukwuma
それはあなたの画像のサイズと画面の幅に対応するためではないはずです。たぶんあなたはプログラムの画面の幅を取得し、画像の数(ハードコーディング)として結果を設定するためにそれを数えることができます。 –