I'm writing a windows phone app that consist of a pivot control, and I want to change the background as I switch between different pivot items. Based on current pivot item's view model information, I will load a background that matches it.
Now what I'm doing is I have some code in onSelectionChanged handler of my pivot control:
if (currentCondition.Contains("a"))
{
image = new BitmapImage(new Uri("Images/a.jpg", UriKind.Relative));
}
else if (currentCondition.Contains("b"))
{
image = new BitmapImage(new Uri("Images/b", UriKind.Relative));
}
ImageBrush ib = new ImageBrush();
ib.ImageSource = image;
this.PivotControl.Background = ib;
This did what I want but the performance is bad, when I switch between different pivot items, it will pause for about half a second to load the image.
Any suggestion on how should I approach to solve the performance problem?
Thanks!
I am not surprised that this causes performance issues, the phone has to decode a full-screen image each time you change the background. I would suggest making your pivot control transparent, then have a 'stack' of images behind. You can then change their visibility in order to show / hide each one. For example:
<Grid>
<Image Source="backgroundOne.jpg" Visibility="Visible"/>
<Image Source="backgroundTwo.jpg" Visibility="Collapsed"/>
<Pivot>
...
</Pivot>
</Grid>
Related
I have a ModalBottomSheetLayout with a list of items in my Compose view, which can be showed by some UI interaction.
By default, when bottomSheetState.show() is called, the visible ratio for the BottomSheet is 50%. However, this is not ideal from a UX perspective as the user will have to physically pull up the bottom sheet to see all the contents in the list.
Extremely frustrating is the fact that bottomSheetState.show() does not take in any parameters, and that the 50% value seems to be hard coded in. According to the declaration in androix.compose.material:
suspend fun show() {
val targetValue =
if (isHalfExpandedEnabled) HalfExpanded
else Expanded
animateTo(targetValue = targetValue)
}
I would like to instead show a custom value, say 75%, when the bottom sheet is showed, but so far I haven't found a way to do so. Is there a workaround to this?
I am not sure if you can make it 75% visible but you can show it expanded
bottomSheetState.animateTo(ModalBottomSheetValue.Expanded)
I'm curious if there's a way to “assign script” to an image inserted into a cell using the =IMAGE(“URL”) method for Google Sheets? If not, is there a way to “assign script” to a hyperlink?
What I’d like to do is create a table of contents tab inside a Google Sheet that has many other tabs. On the table of contents, I’d love to have inserted images that act as buttons to navigate to these different tabs. I can “assign script” to images that have been inserted through the menu toolbar (e.g., Insert > Image or Insert > Drawing). However, it’s extremely clunky to have to realign my images if a new row is inserted into the table of contents.
I could always just use hyperlinks to navigate to each tab, but I don’t like how it opens a new window every time you click on the hyperlink. And I don’t like how it requires two clicks of a hyperlink (one click for the hyperlink, and then another click for the web address that pops up) to arrive at the desired tab.
So I guess, is there any option that exists to insert an image inside a cell, which can then be assigned a script?
This functionality would be so helpful.
Thanks for you time!
I've been searching and haven't found a way to insert a link to anything with an Image placed with the =IMAGE () option. I've resorted to text and formatting .
You can assign a script to change tabs via "floating" Images that are Inserted via insert menu. then on the picture on the top right corner click the arrow and assign the script " goToPage1 " or whatever you decide to call your function and page. it's not as fast as Excel but it works
var ss = SpreadsheetApp.getActiveSpreadsheet();
function goToPage1(){
ss.setActiveSheet(ss.getSheetByName("Page1"));
}
My only solution to this problem is to insert image within cell, then insert a transparent drawing and assign the script to that. It's not ideal, but at least it means the images are aligned perfectly, the transparent floating image just needs to be in the general area
At this time, only to OverGrid images.
Is there a way so that you can set both image and title of UISegmentControl simultaneously, so that image appear next to the title , just like image appear next to title in UIButton.
I am trying but if I set image of Selected segment of UISegmentControl then title disappears and if I set title of Selected segment of UISegmentControl then Image disappears, I want to set both at a time.
The official documentation for -setImage:forSegmentAtIndex: says
A segment can only have an image or a title; it can’t have both. There is no default image.
So, no, there is no way to do what you want using the image and title properties.
However, there are a few options to accomplish the objective in different ways.
if you are going to use the same image for each segment, you could use the appearance methods to set the background and then use the method -setContentOffset:forSegmentAtIndex: to move the title to the side of the background image.
you could create an image that had both the icon and the text in it. This is less than ideal as a change to the text requires exporting of the entire asset again. But is an option.
the least ideal would be to fake a segmented control using buttons that you write the code for to handle state changes. There may even be some open source options that do just that, so feel free to search for them.
I want to display a Doors table with a different style for the first row using RPE.
for example, make the first row have a diferent background color, or other border style.
is there any simple way to do that?
Thanks,
Boris.
My solution was to use a variable called "firstRow" which is Assigned to True in an empty Container before the table, then on the row of the table it is assigned to False.
Then in the background properties I have a script that looks something like:
if (firstRow == "True") {
"SpecialColour";
} else {
"NormalColour";
}
A variation of this script needs to be used for each different property that changes, for example if the first row was centered, with a blue background and bold text, this would need three duplicates of the script. Alternatively if you are exporting to Word you can set a table style in the stylesheet, although I am not quite sure how to explain this without going through it myself again.
Hope that helped!
Hi I am developing a application where I need to display number of images with some conditions. The images should display one by one on the screen when next button is clicked.Here the size of all images is 360x480.When the image is display then all other fields like next and previous buttons should be added to the screen.How to paint those images.Can anybody please help me in this regard.
You can display images with the BitmapField. Use the setBitmap() method to change the image.
Edit: Ok, so you would want to do something like this, put the names of all your bitmaps in an array, have the button's listeners increment or decrement the array index and display that bitmap. So your next button might look like this:
ButtonField nextButton = new ButtonField("Next");
nextButton.setChangeListener(new FieldChangeListener(){
public void fieldChanged(Field field, int context)
{
if(arrayIndex + 1 >= bitmapArray.length)
{
return;
}
arrayIndex++;
Bitmap image = Bitmap.getBitmapResource(bitmapArray[arrayIndex])
myBitmapField.setBitmap(image);
}
});
This assumes that your images are preloaded with your app and are stored in the 'res' directory, if you're downloading them from online or they're stored on the filesystem the way you load the bitmap will be somewhat different. I haven't compiled this code so it may have some bugs but this is roughly what you want to do.