set foreground image on image button in Android - android-widget

I am trying to set a foreground image on my image button. This way, the button gray background is visible with the image appearing in the foreground.
I would appreciate any thoughts, please.
Thanks

If you want to remove that gray background while you set foreground image then set an empty Background image.
or Simply instead of setting foreground image set only background image to button.
I hope this will help you.
Edited with code
<ImageButton android:text="Button" android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/icon"/>
<ImageButton android:text="Button" android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/icon"/>

Only use the button instead imagebutton. And in xml use the android:background="#drawable/yourdrawablewhichyouwanttoshow" hope it helps!

Related

Splash screen Flutter

I added the logo in different resolutions in folders for splash screen.
When my app start, i see a logo with resolution 280x175 (i uploaded a logo of this resolution, because it looks good). In splash screen its looks diffuse. How can I show the logo in high resolution?
If I add a logo in a higher resolution, it does not fit on the screen.
I need logo in splash screen in size 280px width
I have folders in src/main/res and uploaded logos there
drawable
resolution logo - 280x175
drawable-v21
resolution logo - 280x175
mipmap-hdpi
resolution logo - 800x480
mipmap-mdpi
resolution logo - 480x320
mipmap-xhdpi
resolution logo - 1280x720
mipmap-xxhdpi
resolution logo - 1600x960
mipmap-xxxhdpi
resolution logo - 1920x1280
My code in folders - drawable and drawable-v21
launch_background.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="#android:color/white" />
<!-- You can insert your own image assets here -->
<item>
<bitmap
android:layout_height="fill_parent"
android:gravity="center"
android:src="#drawable/logo"
</item>
</layer-list>
How to change the code so that the logo on the home screen is clear and sharp?

How to resize Splash Screen Image in MAUI?

I'm trying to add an image on Splash Screen and the image size is 512x512 but it is not showing correctly on the splash screen. So, is there a way to resize the splash screen image?
Yes, there is a known issue about this problem. And this issue has been moved to the Backlog milestone. This means that it is not going to be worked on for the coming release.
You can follow it up here: https://github.com/dotnet/maui/issues/10275 .
Similar issue here: https://github.com/dotnet/maui/pull/9797 .
Thanks for your support and feedback for maui.
You can refer to step 5 of my blog on how to add/change the Splash screen image.
Basically, you have to edit your project file & edit the MauiSplashScreen ItemGroup property BaseSize accordingly to fit your image.

Add Image to Android App in Eclipse

I have a background image added to my project, but I was wanting to add a logo image to the bottom of the GraphicalLayout. I wanted to do it this way so that I can keep the background and logo separate. Thanks for any help.

Mobclix Ads are not center alligned?

I am using MobClix for displaying Ads, but some Ads are not center aligned, but they are left aligned. I have set contentMode of the view to UIViewContentModeCenter but it didn't work, How to fix this.
(In the image some white space at the end)
I use MobclixMMABannerXLAdView from Mobclix SDK on android and it has fixed size.
As for me layout adjustment to show ads on the center of screen.
for RelativeLayout following code works fine:
<com.mobclix.android.sdk.MobclixMMABannerXLAdView
android:id="#+id/advertising_banner_view"
android:layout_height="50dp"
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:tag="adspace" />

Dim iPhone screen

I'm working on an application where it may be used in a dark area and the brightness is required to be lowered. I wanted to put this into the application, and thought that I could add a UIView with a black bg color and change the alpha, but this gets in the way of the user interaction.
Does anyone have an idea on how to do this without blocking human interaction?
Thanks
Set the UIView's userInteractionEnabled property to NO.