I am using BrowserField component of RIM BB. It is right now displaying a white background. I want make a transparent background, so it could match with the Manager's background color.
I had tried with below code. But it's not working.
BrowserField contentField = new BrowserField();
bgTransparent = BackgroundFactory.createSolidTransparentBackground(0xffffff, 0);
contentField.setBackground(bgTransparent);
How to solve this?
Related
I'm trying to change the backgorund colour of a ListView item on ios.
for Android i have this in my index.tss and it works fine :
'#ListView': {
top:'0%',
left:'0%',
height:'100%',
width:'98%',
zIndex:1,
backgroundImage: "/main.png",
backgroundColor:'#2e2f30',
borderColor:'transparent',
borderWidth:0,
borderRadius:0,
separatorColor:'#2d2f2f',
opacity:1
Im using an ImageView inside each item to basically just create and display a scrollable image list.
On Android, each row displays the image perfectly full without the white border around the image like on ios.
I want to remove the white colour background around the image on each row.
Titanium SDK 8.0
Regards
Sorry for the late answer.
I have set the item to transparent, thanks Mr. mukesh.kumar .
Regards
I tried making the small icon exactly 16x16, gray-scaled, nothing but gray and white (the gray color being hex value 616161), to create a silhouette of my application icon.
Yet no matter what it just shows up as a white/gray square in the notifications. What am I doing wrong?
(My min api is 21, assuming it is relevant)
Follow this link
First let’s understand the Android documentation which is as follows
“Update or remove assets that involve color. The system ignores all
non-alpha channels in action icons and in the main notification icon.
You should assume that these icons will be alpha-only. The system
draws notification icons in white and action icons in dark gray.”
Now this is easy to miss and I have seen many apps that are live in the app store with thousands of users who haven’t followed the mentioned guidelines.
So let me explain in detail how you can convert your notification icon to an Android friendly one with a few clicks.
In your favourite image editor open up your icon file. Convert all parts of the image that you don’t want to show to transparent pixels. All colors and non transparent pixels are displayed in white. Let us go through an example.
EDITED: Thanks #Andrey Patseiko for the tool
For notification you have to use different icons for different versions of android:
Notification notification = new Notification.Builder(context)
.setAutoCancel(true)
.setContentTitle("My notification")
.setContentText("Look, white in Lollipop, else color!")
.setSmallIcon(getNotificationIcon())
.build();
return notification;
Get notification icon on the basis of version
private int getNotificationIcon() {
boolean useWhiteIcon = (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP);
return useWhiteIcon ? R.drawable.icon_silhouette : R.drawable.ic_launcher;
}
Along with new features and capabilities, Android 5.0 includes a variety of system changes and API behavior changes. See the notification behavior changes.
Notifications are drawn with dark text atop white (or very light)
backgrounds to match the new material design widgets. Make sure that
all your notifications look right with the new color scheme. If your
notifications look wrong, fix them:
Use setColor() to set an accent color in a circle behind your icon image.
Update or remove assets that involve color. The system ignores all non-alpha channels in action icons and in the main notification icon.
You should assume that these icons will be alpha-only. The system
draws notification icons in white and action icons in dark gray.
So, basically you have to use silhouette icons as notification icon for API Level 21+
I am using BrowserField to display some local HTML files in my application. It is displaying the HTML files properly. But while starting of the screen it is displaying some white screen (background). How can i get rid of this issue?
I am using the below code:
BrowserFieldConfig _bfConfig = new BrowserFieldConfig();
_bfConfig.setProperty(BrowserFieldConfig.NAVIGATION_MODE,BrowserFieldConfig.NAVIGATION_MODE_POINTER);
_bfConfig.setProperty(BrowserFieldConfig.JAVASCRIPT_ENABLED, Boolean.TRUE );
_bfConfig.setProperty(BrowserFieldConfig.USER_AGENT, "MyApplication 1.0");
BrowserField myBrowserField = new BrowserField(_bfConfig);
add(myBrowserField);
BrowserFieldRequest request = new BrowserFieldRequest("local:///OTPhelp_en.html");
myBrowserField.requestContent(request);
I don't have a perfect answer for you. If you take a look at this question, so far, no answers have been given as to how to make the BrowserField background transparent, which would be one way to solve your problem.
Depending on how your OTPhelp_en.html page is written, how much control over it you have, and how often it changes, this may be a workaround that's acceptable:
If your html file has a solid background color, and you know what that color is (because it's your html content), then you could simply set the BrowserField background color to match. Then, you wouldn't see any white flash before the html content is rendered. Something like this:
public class MyBrowserScreen extends MainScreen {
// this assumes the html file uses a red (#ff0000) background
private int BG_COLOR = Color.RED;
public MyBrowserScreen() {
// set the screen manager's background
getMainManager().setBackground(BackgroundFactory.createSolidBackground(BG_COLOR));
BrowserFieldConfig _bfConfig = new BrowserFieldConfig();
_bfConfig.setProperty(BrowserFieldConfig.NAVIGATION_MODE,BrowserFieldConfig.NAVIGATION_MODE_POINTER);
_bfConfig.setProperty(BrowserFieldConfig.JAVASCRIPT_ENABLED, Boolean.TRUE );
_bfConfig.setProperty(BrowserFieldConfig.USER_AGENT, "MyApplication 1.0");
BrowserField myBrowserField = new BrowserField(_bfConfig);
// set the browser field background to match the HTML background, and
// the containing screen's background
_myBrowserField.setBackground(getMainManager().getBackground());
add(myBrowserField);
BrowserFieldRequest request = new BrowserFieldRequest("local:///OTPhelp_en.html");
myBrowserField.requestContent(request);
Of course, hardcoding it in this way means that if the HTML file changes its background color, you'll need to change it in the Java code, too.
If you wanted to avoid that, and you knew the HTML file would always use a solid background color, you could first open the html file as a resource stream
getClass().getResourceAsStream("/OTPhelp_en.html");
and then parse it, searching for the background color (e.g. <body bgcolor= or <body style="background-color:). That would at least allow the browser field to look right if a simple background color change is made in the HTML file.
If the HTML file uses a gradient background, or an image background, the above code will have to be changed. But, without more information, that's my suggestion for a workaround.
how can i call the popupScreen on top of my main screen. it functions as a user login
I'm not sure what version of the SDK you are using but I've used the following:
DialogFieldManager manager = new DialogFieldManager();
PopupScreen popup = new PopupScreen(manager);
UiApplication.getUiApplication().pushScreen(popup);
popup.doPaint();
The following link will help you to find solution for push the popup screen on the top of the main screen
Dialog box background color on Blackberry
I am building an application for BB curve 320*240,where i am adding a backgroundimage of size 240*200.On that background image we are adding gridfield manager with contents.The issue is that the last few contents are getting out of the backgroundimage.How can i fix it to fit within the background image
You would create a Manager (VerticalFieldManager, as a simple example), limit its size to 240x200, and set it's background image to your bitmap. Then, add this VerticalFieldManager to your screen, and add all the other controls, like your gridfield manager to the new VerticalFieldManager container.