ImageButton 越来越大
ImageButton getting bigger and bigger
我使用 glide 在 ImageButton 视图中加载图像。单击按钮将打开相机,拍摄的照片将出现在按钮上。
我遇到了一个很奇怪的问题,每拍一张照片,按钮上的图像都会变大..
你知道为什么吗?
一些代码可能会有所帮助:
// I use this to update the ImageButton
RequestManager glide = Glide.with(this);
glide.clear(mLeftTopImageButton);
glide.load(file.getAbsolutePath()).into(mLeftTopImageButton);
在 xml 文件上:
<LinearLayout
android:orientation="vertical"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:layout_weight="1" >
<ImageButton
android:background="?android:colorBackground"
android:id="@+id/button1_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_menu_camera" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="12sp"
android:textStyle="bold"
android:gravity="center_horizontal"
android:text="Button1"/>
</LinearLayout>
编辑:
这是图片中的一个例子
谢谢,
正如@"Lalit Singh Fauzdar"所说,为了防止这种行为,固定高度就足够了。
我使用 glide 在 ImageButton 视图中加载图像。单击按钮将打开相机,拍摄的照片将出现在按钮上。 我遇到了一个很奇怪的问题,每拍一张照片,按钮上的图像都会变大..
你知道为什么吗?
一些代码可能会有所帮助:
// I use this to update the ImageButton
RequestManager glide = Glide.with(this);
glide.clear(mLeftTopImageButton);
glide.load(file.getAbsolutePath()).into(mLeftTopImageButton);
在 xml 文件上:
<LinearLayout
android:orientation="vertical"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="12dp"
android:layout_weight="1" >
<ImageButton
android:background="?android:colorBackground"
android:id="@+id/button1_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_menu_camera" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="12sp"
android:textStyle="bold"
android:gravity="center_horizontal"
android:text="Button1"/>
</LinearLayout>
编辑:
这是图片中的一个例子
谢谢,
正如@"Lalit Singh Fauzdar"所说,为了防止这种行为,固定高度就足够了。