【发布时间】:2016-01-24 08:09:29
【问题描述】:
我在尝试在布局中使用图像按钮时遇到问题。添加第一个图像按钮时一切正常,但是当我添加第二个图像按钮时,第一个会缩小,这是否取决于我使用的布局?我设置了相对布局,但我不知道如何让每个按钮保持相同大小。
<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:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.example.supernovastudios.conguate.preguntas3"
android:background="#222222">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageButton5"
android:background="@drawable/botonpregunta"
android:layout_centerHorizontal="true" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/botonpregunta"
android:id="@+id/imageButton6"
android:layout_alignTop="@+id/imageButton5"
android:layout_centerHorizontal="true"
android:layout_marginTop="143dp" />
<ImageButton
android:layout_width="wrap_content"
android:background="@drawable/botonpregunta"
android:layout_height="wrap_content"
android:id="@+id/imageButton7"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="104dp" />
这是布局的图片。中间的按钮是唯一保持其原始大小的按钮,而其他按钮在我向上或向下移动时似乎会缩小。
【问题讨论】:
-
可以贴一下xml代码吗?
-
如果您需要帮助解决问题,请使用您的代码编辑问题!
-
@Sameer 我上传了代码!对不起,我花了这么长时间
标签: android