Github user AlexTalis commented on a diff in the pull request:

    
https://github.com/apache/cordova-plugin-splashscreen/pull/43#discussion_r27445114
  
    --- Diff: src/android/SplashScreen.java ---
    @@ -194,9 +263,25 @@ public void run() {
                     // TODO: Use the background color of the webView's parent 
instead of using the
                     // preference.
                     
root.setBackgroundColor(preferences.getInteger("backgroundColor", Color.BLACK));
    +                
                     root.setLayoutParams(new 
LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                             ViewGroup.LayoutParams.MATCH_PARENT, 0.0F));
    -                root.setBackgroundResource(drawableId);
    +                
    +                // Use an ImageView to render the image because of its 
flexible scaling options.
    +                splashImageView = new ImageView(context);
    +                splashImageView.setImageResource(drawableId);
    --- End diff --
    
    Setting ImageView background color does work. It just does not show with 
any of the current scaling options. Without "maintain aspect ratio" the image 
is stretched to fit screen, so you never see the background. With "maintain 
aspect ratio" the image covers the screen fully, so again you don't see the 
background.
    
    If I hard-code a scaling option like FIT_CENTER, then ImageView background 
color does fill areas that are not covered by the drawable. So if the purpose 
of BG color is to simply fill areas not covered by the drawable, then we can 
take out LinearLayout. I thought that the purpose was to somehow cover up the 
WebView in background if the device is rotated, which probably wouldn't work 
anyway. Here's the test app without LinearLayout, with scale mode temporarily 
set to FIT_CENTER and BG color set to RED:
    
    
![image](https://cloud.githubusercontent.com/assets/1012600/6910105/4eb48854-d703-11e4-8d08-f5ecce5bea91.png)



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org

Reply via email to