Bug 23835 - 9-patch not working
Summary: 9-patch not working
Status: RESOLVED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 4.18.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2014-10-15 06:18 UTC by Stevan Mladenovic
Modified: 2015-10-06 17:32 UTC (History)
11 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Stevan Mladenovic 2014-10-15 06:18:06 UTC
With latest release 9-patch is not working. It seems like 9-patch are not processed at all. They are shown like normal images.
Comment 1 Rajneesh Kumar 2014-10-15 12:25:26 UTC
I have checked this issue and not able to reproduce. To reproduce this issue I have followed the steps mentioned below:

1. Create an android application in XS
2. Add a normal image and a 9-path image to drawable folder
3. Open Main.axml and go to source view
4. Add background to the normal image
     android:background="@drawable/normal"
5. Go to design view and observe that the normal pic does not stretch and not fill whole background
6.  Add background to the normal image
     android:background="@drawable/mypic"
7. Go to design view and observe that the 9-patch pic stretch and fill the background

I observed that 9-patch image is working properly, and its different from the normal image.

Could you please provide us your environment info, steps to reproduce this issue? Please let me know that what steps I am missing to reproduce this issue? That will be helpful to reproduce this issue at our end.

Screencast: http://www.screencast.com/t/0baqzoYoUFn

Environment Info:

=== Xamarin Studio ===

Version 5.5.2 (build 0)
Installation UUID: a7e29e93-6348-4126-9ebc-b2777c96a552
Runtime:
	Microsoft .NET 4.0.30319.18408
	GTK+ 2.24.22 (MS-Windows theme)
	GTK# 2.12.26

=== Xamarin.Android ===

Version: 4.18.0 (Business Edition)
Android SDK: E:\android-sdk
	Supported Android versions:
		2.1    (API level 7)
		2.2    (API level 8)
		2.3    (API level 10)
		3.1    (API level 12)
		4.0    (API level 14)
		4.0.3  (API level 15)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		4.5    (API level 21)
Java SDK: C:\Program Files (x86)\Java\jdk1.6.0_39
java version "1.6.0_39"
Java(TM) SE Runtime Environment (build 1.6.0_39-b04)
Java HotSpot(TM) Client VM (build 20.14-b01, mixed mode)

=== Build Information ===

Release ID: 505020000
Git revision: a5887be38215a6cdd3f349e102ef82a1c4f950a4
Build date: 2014-10-14 12:21:34-04
Xamarin addins: 069ddd29bb70a42238142eee9bac21a5e4b2f9f9

=== Operating System ===

Windows 6.2.9200.0 (64-bit)
Comment 2 ca 2014-10-16 03:19:19 UTC
I have the same problem with 9-patch.
But if I move all my 9-patch image to the drawable-folder it works.
So 9-patch images in ex. drawable-hdpi dosn't work for me anymore.
Comment 3 Frederik Skytte 2014-10-16 03:21:27 UTC
Try to move your images to the appropriate folders:
drawable-mdpi, drawable-hdpi, drawable-xhdpi
This happens to all my 9patch images at least and completely brakes the app!
Comment 4 Rajneesh Kumar 2014-10-16 06:56:20 UTC
@ ca@onlimited.dk and Frederik Skytte : Thanks for the valuable comment.

I have checked this issue again now and able to reproduce this issue. 

Steps I have followed:

1. Create an android application in XS
2. Add drawable-mdpi,drawable-hdpi,drawable-xhdpi folders under 'Resources'
2. Add a normal image and a 9-path image to appropriate folders
3. Open Main.axml and go to source view
4. Add background to the normal image
     android:background="@drawable/normal"
5. Go to design view and observe that the normal pic does not stretch and not fill whole background
6.  Add background to the 9-patch image
     android:background="@drawable/mypic"
7. Go to design view and observe that the 9-patch pic does not stretch and not fill whole background

I observed that 9-patch image is not working properly, They are shown like normal images.

Screencast: http://www.screencast.com/t/BHkQoH406Z

Environment info: 
=== Xamarin Studio ===

Version 5.5.2 (build 0)
Installation UUID: a7e29e93-6348-4126-9ebc-b2777c96a552
Runtime:
	Microsoft .NET 4.0.30319.18408
	GTK+ 2.24.22 (MS-Windows theme)
	GTK# 2.12.26

=== Xamarin.Android ===

Version: 4.18.0 (Business Edition)
Android SDK: E:\android-sdk
	Supported Android versions:
		2.1    (API level 7)
		2.2    (API level 8)
		2.3    (API level 10)
		3.1    (API level 12)
		4.0    (API level 14)
		4.0.3  (API level 15)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		4.5    (API level 21)
Java SDK: C:\Program Files (x86)\Java\jdk1.6.0_39
java version "1.6.0_39"
Java(TM) SE Runtime Environment (build 1.6.0_39-b04)
Java HotSpot(TM) Client VM (build 20.14-b01, mixed mode)

=== Build Information ===

Release ID: 505020000
Git revision: a5887be38215a6cdd3f349e102ef82a1c4f950a4
Build date: 2014-10-14 12:21:34-04
Xamarin addins: 069ddd29bb70a42238142eee9bac21a5e4b2f9f9

=== Operating System ===

Windows 6.2.9200.0 (64-bit)
Comment 5 Craig 2014-10-16 13:37:31 UTC
!!! :(
Comment 6 Craig 2014-10-16 13:39:10 UTC
guys is there a way to downgrade xamarin to a version that doesn't have these issues?
Comment 7 Stevan Mladenovic 2014-10-16 13:42:38 UTC
@Craig Go to dashboard for your account on xamarin site and you have downloads section. There you can download any version you whant.
Comment 8 Craig 2014-10-16 13:47:09 UTC
Thanks.
Comment 9 Matthew Leibowitz 2014-10-18 18:44:05 UTC
Just want to add a note that may be useful: this also happens to the items in the support libraries. 
For example, if I add an action bar item that has an actionViewClass="android.support.v7.widget.SearchView", the underline of the text box is not 9-patched, but stretched
Comment 10 ca 2014-10-21 02:00:50 UTC
Is there a estimate on then this bug will be resolved?
Comment 11 Shane Raiteri 2014-10-21 06:28:55 UTC
For anyone else experiencing this issue on Mac OSX here is how I temporarily reverted Xamarin.Android to resolve the issue:

1. Browse to https://store.xamarin.com/account/my/subscription/downloads, select 'View all versions' and download Xamarin.Android 4.16 (Sept 12, 2014).
2. Install the pkg and restart Xamarin Studio (ignore any updates that are suggested obviously).
3. Clean Android project and rebuild.

For reference, my environment is:

------------

=== Xamarin Studio ===

Version 5.5.2 (build 3)
Installation UUID: 6b132847-55cb-494c-b366-6bb7d48c3ac5
Runtime:
	Mono 3.10.0 ((detached/e204655)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000023

=== Apple Developer Tools ===

Xcode 6.1 (6604)
Build 6A1052d

=== Xamarin.iOS ===

Version: 8.4.0.14 (Business Edition)
Hash: 1d464a1
Branch: 
Build date: 2014-10-17 21:50:07-0400

=== Xamarin.Android ===

Version: 4.16.0 (Business Edition)
Android SDK: /Users/{USER}/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		1.6    (API level 4)
		2.1    (API level 7)
		2.2    (API level 8)
		2.3    (API level 10)
		3.0    (API level 11)
		3.1    (API level 12)
		4.0    (API level 14)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		4.5    (API level 21)
Java SDK: /usr
java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)

=== Xamarin.Mac ===

Version:

=== Build Information ===

Release ID: 505020003
Git revision: 6d4c806e383ba366b15fbccca9ddc1ba94f8d5ad
Build date: 2014-10-15 15:00:36-04
Xamarin addins: 069ddd29bb70a42238142eee9bac21a5e4b2f9f9

=== Operating System ===

Mac OS X 10.9.5


Android SDK Tools: 23.0.5
Android Platform Tools: 21
Android SDK Build-Tools: 20 (up to 21.0.1 installed)

------------

With Xamarin.Android 4.18 installed, I also encountered @Matthew's issues with SearchView, which is where I first noticed there was a problem. It is particulary bad on Android 2.3 devices for all ActionBar icons that are inherited from support libs.
Comment 12 Craig 2014-11-10 15:03:37 UTC
Please give this bug higher priority and get it fixed as soon as possible.

We are planning on releasing a new version of our app once some of the Lollipop bugs are fixed: 

https://bugzilla.xamarin.com/show_bug.cgi?id=23959
https://bugzilla.xamarin.com/show_bug.cgi?id=24268

We can't release the app unless this 9-patch is also fixed.  Reverting to a prior version of Xamarin is not an option for us at this point since we want to incorporate the latest bug fixes.

Thanks.
Comment 13 Shane Raiteri 2014-11-10 17:13:40 UTC
@Craig - I  believe this has been 'temporarily' fixed as part of the Xamarin.Android 4.18.1 (bug 23823 - https://bugzilla.xamarin.com/show_bug.cgi?id=23823). As the bug (and 4.18.1 release notes detail), they have reverted to the Xamarin.Android 4.16 way method of doing things, and will look to resolve in a later release.

Not noticing issues on the 4.18.1 update anymore.
Comment 14 Craig 2014-11-10 17:40:03 UTC
Ok thanks!
Comment 15 Matthew Regul 2015-10-06 14:59:49 UTC
This appears to have been fixed at some point.

My Project Sample
https://dl.dropboxusercontent.com/u/62849286/9Patch/SplashScreen%289patch%29.zip

Screenshot - App Running (sorry, I should have picked a nicer color to demonstrate the "drawable" text)
https://dl.dropboxusercontent.com/u/62849286/9Patch/Running.png

Screenshot - Code
https://dl.dropboxusercontent.com/u/62849286/9Patch/Sample.png


=== Xamarin Studio ===

Version 5.9.7 (build 9)
Installation UUID: 3477b147-e3de-47d4-87f5-4f0230db8f1e
Runtime:
	Mono 4.0.4 ((detached/d481017)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400040004

=== Xamarin.Android ===

Version: 5.1.6.7 (Enterprise Edition)
Android SDK: /Users/matthewr/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.4   (API level 19)
		5.0   (API level 21)
		5.1   (API level 22)
Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 7.0 (8227)
Build 7A220

=== Xamarin.iOS ===

Version: 9.0.1.20 (Enterprise Edition)
Hash: d8e9592
Branch: master
Build date: 2015-09-18 23:22:05-0400

=== Xamarin.Mac ===

Version: 2.0.2.111 (Enterprise Edition)

=== Build Information ===

Release ID: 509070009
Git revision: 31fa64709030b3edb971237780a452a4c69943c4
Build date: 2015-09-17 11:44:37-04
Xamarin addins: b105d33d8cd72911ff2cf3ee0b7715d37e5f19a6

=== Operating System ===

Mac OS X 10.10.5
Darwin mMac.home 14.5.0 Darwin Kernel Version 14.5.0
    Wed Jul 29 02:26:53 PDT 2015
    root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64
Comment 16 Jonathan Pryor 2015-10-06 17:32:45 UTC
Marking as FIXED as per Comment #13 and Comment #15.