I'm new in the android programmation world and I'm facing some layout design problems. There is a padding in the layout containing the two images, see the red arrow:
http://www.servimg.com/view/13840630/200
As you can see I'm using the wrap_content attribute for both heigh and width, so I don't really understand why this is happening...
Here is my layout:
<LinearLayout 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:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.scimoon.henri.scimoon.Game"
android:background="@color/white"
android:orientation="vertical">
<LinearLayout
android:orientation="horizontal"
android:paddingTop="15dp"
android:paddingBottom="5dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/darkBlue"
android:id="@+id/back">
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/back"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="@string/back"
android:textColor="@color/white"
android:textSize="35dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_horizontal"
android:layout_weight="1">
<ImageView
android:id="@+id/bt_bleu"
android:scaleType="fitXY"
android:adjustViewBounds="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:src="@drawable/bt_bleu"
android:layout_weight="1"/>
<ImageView
android:id="@+id/bt_rouge"
android:scaleType="fitXY"
android:adjustViewBounds="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/bt_rouge"
android:layout_weight="1"/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_horizontal"
android:layout_weight="1">
<ImageView
android:id="@+id/bt_jaune"
android:scaleType="fitXY"
android:adjustViewBounds="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:src="@drawable/bt_jaune"
android:layout_weight="1"/>
<ImageView
android:id="@+id/bt_vert"
android:scaleType="fitXY"
android:adjustViewBounds="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/bt_vert"
android:layout_margin="0dp"
android:padding="0dp"
android:layout_weight="1"/>
</LinearLayout>
</LinearLayout>
Any idea how to get rid of this ?
在您的res文件夹中,有一个名为values的文件夹,其中应存在一个名为dimens.xml的文件,打开该文件,您会发现边距设置为1dp或0dp
在两个包含圆圈的LinearLayouts上删除android:layout_weight="1"
。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.