How to set toolbar in Wechat Applet - wechat

I want to set toolbar with 3 or 4 icon buttons. When an icon is clicked, a slider with a select box should appear. Is a toolbar component and a select dropdown slider component available in the Wechat Mini program?
Customised tool bar

var sys= wx.getSystemInfoSync()
var menu = wx.getMenuButtonBoundingClientRect()
var statusHeight = menu.statusBarHeight
var titleHeight = menu.height
var titleRowWidth = sys.right - menu.right
var titleColumnHeight = menu.top - menu.statusBarHeight
Fisrt,open the file "app.json". Updating the value of "navigateionStyle" as "custom",and then the pageHeader will display.You can custom the top part of page.But the menu "button" like capsule at right-top of page will exist there.So you could calculate some parameters.
Maybe,the image will help you understand this.
ABout your searchBar,you can use this method to create your custom labels.If you need to use it in some pages,you can package this as a custom component.

Related

How do I add a notification within a master detail page that slides from the right when a button is pressed

I need to add a notification content that will slide from the right when a button in the header is pressed. The header is a boxview with buttons inside.
This is what I am trying to achieve:
This is what I have now(button does nothing):
I don't think Xamarin.Forms supports two Master pages (Drawers) but what you could do is add a view inside your page with it's TranslationX set to the Width of the screen, then add a ToolbarItem that, when pressed, Translates the X of the view to 0, and when pressed again, translates the view to the screen's width again. The only drawback is that this view would be below the AppBar (not like your picture that the notification panel is in front of the AppBar and the StatusBar).
The code would be something like this:
The notifications panel part:
// I think 260 is a good width (but I didn't test), experiment and see
var notificationsPanel = new StackLayout { WidthRequest = 260 };
// Needed because we don't know the Width yet
SizeChanged += (sender, e) =>
{
if(Width > 0)
notificationsPanel.TranslationX = Width;
}
The Width property is the Width of the page.
The ToolbarItem part:
if(notificationsPanel.TranslationX > 0)
notificationsPanel.TranslateTo(Width - notificationsPanel.Width);
else
notificationsPanel.TranslateTo(Width); // Here the Width will already be set
The Content of the Page:
Content = new Grid
{
Children =
{
actualContent,
notificationsPanel
}
}
Hope it helps!
EDIT
An easier idea would be to create your page without the Notifications Panel and use this library: Rg.Plugins.Popup to add the NotificationsPanel as a Popup instead of as a view inside the page.
This library has a wiki page here: Wiki. You can create a XAML page for your Popup and add a ToolbarItem on the "Root" page that, when clicked, calls a simple method that checks if a Popup is showing, if it's not, add it, if it is, remove it (a toggle-like method). Something like this:
if (PopupNavigation.PopupStack.Count > 0)
PopupNavigation.PopAsync();
else
PopupNavigation.PushAsync(new NotificationsPanel());
If you don't know how to add a ToolbarItem, it's something like this:
ToolbarItems.Add(new ToolbarItem
{
Text = "Notifications",
Icon = "notifications-icon.png" // change this based on your image requirements, Xamarin.Forms has more than one way to store images
Command = new Command(() =>
{
if (PopupNavigation.PopupStack.Count > 0)
PopupNavigation.PopAsync();
else
PopupNavigation.PushAsync(new NotificationsPanel());
})
});
If you want to know more about images with Xamarin.Forms: Working with Images
That's it. If you want you can add animations (to make the NotificationsPanel come from the right side of the screen) and in the NotificationsPanel PopupPage, remember to make the view aligned to the right and with a WidthRequest smaller than the screen's Width.
Hope it helps!

Button as spinner in android

I have two buttons YES and NO.
If user click on the yes Button the Dropdown menu like Spinner should appear
which contains other parameters related to Yes.
user will select one Parameter from that menu(dropdown menu)
I used this line for spinner button
android:background="#android:drawable/btn_dropdown"
OnClick method for Button:
ArrayList<String> spinnerArray = new ArrayList<String>();
spinnerArray.add("one");
spinnerArray.add("two");
spinnerArray.add("three");
spinnerArray.add("four");
spinnerArray.add("five");
ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(context, android.R.layout.simple_spinner_dropdown_item, spinnerArray);
spinner.setAdapter(spinnerArrayAdapter);
spinner.setOnItemSelectedListener(this);
with this code my button is look like spinner but on Click dropdown menu not appearing.
How to do this.?????
set your spinner launch mode to dialog android:spinnerMode=dialog this will display a dialog on click and let the user choose a option.

Dynamically loaded QML-file in Tab will only be executed when Tab is shown

I'm creating Tabs in a TabView dynamically via
var component = Qt.createComponent("file://tabcontent.qml"));
tabView.addTab(component);
However their code is not executed before I click on the Tab itself.
How can I solve this?
The created Tab inherits from Loader with its active property set to false until the Tab is clicked. Just explicitly set the active property after creating it:
var component = Qt.createComponent("file://tabcontent.qml'));
var tab = tabView.addTab(component);
tab.active = true;

how to place dojo widget like text button on google map as custom control

I am trying to place a dojo button on google map. How to do this ? I tried creating button like
var tbutton = new dijit.form.Button({id: "showUsers", label: "User"});
controlUI.appendChild(tbutton);
(controlUI is parent div which gets placed on map)
also tried
controlUI.appendChild(tbutton.domNode);
None of them work.
Try dojo.place
dojo.place(tbutton.domNode, controlUI);

Dynamically adding radiobuttongroup

I'm trying to make a quiz in flex and am loading data from an xml file. For each question I want to create a radiobuttongroup so I can associate radio buttons to it. How can I accomplish that with actionscript? I can see that addChild method works for DisplayObjects and I presume that radiobuttongroup is not one because I'm receiving errors. How can I dynamically add radiobuttongroup with actionscript in flex application? Thanks.
If you add radio buttons to a FormItem, they are automatically grouped together. So, assuming your quiz uses a Flex Form for layout, you simply generate a FormItem for each question, add a button for each option to the FormItem, then add that FormItem to your main Form.
private function generateQuestions(questions:XML):void
{
var form:Form = new Form();
this.addChild(form);
for each (var question:XML in questions.question)
{
var questionItem:FormItem = new FormItem();
form.addChild(questionItem);
questionItem.label = question.#text;
for each (var option:XML in question.option)
{
var optionButton:RadioButton = new RadioButton();
optionButton.label = option.#text;
questionItem.addChild(optionButton);
}
}
You create the radio buttons, add them to the display, create a group for them and declare the radio buttons to belong to the same group (RadioButton.group = group1). The RadioButtonGroup is indeed not a display object but just tells the radio buttons belonging to that group that they should acts as one element.
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/fl/controls/RadioButtonGroup.html
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/fl/controls/RadioButton.html

Resources