I want to display several widgets with dynamic size in a flowlayout fashion, but I can't seem to find a flowlayout. Is it really no flowlayout in Xamarin for Android as part of the framework?
No,there is not flowlayout in Xamarin Android as far as I know.
Came across this implementation
http://slodge.blogspot.no/2013/01/an-mono-for-android-wrappanelflowlayout.html
which suits my needs perfectly.
In Xamarin Android FlowLayout available. Install nuget package AndroidFlowLayout by Dennis Daume. Make xaml like this
<org.apmem.tools.layouts.FlowLayout
android:id="#+id/ControlPanel"
android:padding="0dp"
android:includeFontPadding="false"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
Aceess your flow layout in .cs page & add controls as many you need. Even your can add controls from xaml too.
var flaout = view.FindViewById<FlowLayout>(Resource.Id.ControlPanel);
foreach (var item in SenderData)
{
var checkbox = new CheckBox(Context);
checkbox.SetCompoundDrawablesWithIntrinsicBounds(Resource.Color.DimGray, 0, 0, 0);
checkbox.Id = Convert.ToInt32(mailList.Value);
checkbox.Text=item.Name
checkbox.ScaleY = 0.8f;
checkbox.ScaleX = 0.9f;
flaout.AddView(checkbox);
}
There's also this from Jason Smith from Xamarin, for Xamarin.Forms:
WrapLayout.cs
It's the code from this talk from Xamarin Evolve 16.
I believe what you are looking for is called the FlexLayout, introduced with Xamarin.Forms version 3.0:
https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/layouts/flex-layout
Related
I'm new to StackOverflow community!
I need help with one problem with android in Xamarin Forms. To be precise... I tried with some friends to build our first app. We choose(with the help of our University professor) Xamarin for the cross-platform development of Android and iOS for both systems using the Xamarin Forms. I created the interface part of the app and now I am stuck in a fort with big walls. When I try to add a Tabbed Page the icon for the functional bar, the app crashes(Android) but in iOS, the problem doesn't appear...
I'd try with some solution... like :
-Render in the NameApp.Droid adds different renderer only for the android part but no result...
-Try another way to insert the icon in the .xaml file directly but no result...
-Try to follow another way to modify the .axam file for the "Theme" part
but no result...
I want to integrate all the stuff on time only in the "Main Project". I don't want for now touch the "nameProject.Droid" or "nameProject.iOS" part, But try to make in one shoot both(Andriod & iOS). I've found a different bug in Android (è.é) but for this, I am going crazy...
But I need to modify the ".Droid" no problem I accept the challenge!
This is the result I aspire to create.
"https://storage.googleapis.com/material-design/publish/material_v_12/assets/0B6Okdz75tqQsbHJuWi04N0ZIc0E/components-tabs-usage-mobile7.png"
This is the way I add the Icon in the Tabbed Page. An assumption I add all the stuff in the "Resource" in ".Droid" and ".iOS :
var MainPageTabbed = new MPageTabbed();
var Profile = new Profile();
var ListChat = new ListChat();
if (Device.RuntimePlatform == Device.Android)
{
MainPageTabbed.Icon = "ldpi.png";
Profile.Icon = "ldpi2.png";
Chat.Icon = "ldpi1.png";
}
if (Device.RuntimePlatform == Device.iOS)
{
MainPageTabbed.Icon = "ldpi.png";
Profile.Icon = "ldpi2.png";
ListChat.Icon = "ldpi1.png";
}
NavigationPage.SetHasNavigationBar(this, false);
Children.Add(MainPageTabbed);
Children.Add(Profile);
Children.Add(ListChat);
Someone can help me please to find a solution?
Here you have an example of how to use the TabbedPage in xamarin forms:
https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/navigation/tabbed-page/
... Xamarin.forms renders Android tabbed-pages as something called a viewpager combined with a TabPagerStrib, and it looks like the example in the link above.
You might read about BottomNavigationBar for Android instead, or look at this link for a TabPagerStrip with an image:
https://forums.xamarin.com/discussion/39937/adding-icons-to-a-pagertabstrip-instead-of-text
If anyone is interested in a FontAwesome custom icon implementation I followed this tutorial to begin with: FontAwesome with Xamarin Forms
Unfortunately he doesn't give an example of integrating with tabbed pages but after some experimenting I finally figured out a simplified Xaml way to render it without a custom tabbed renderer:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:IBMobile.Views"
xmlns:local2="clr-namespace:FontAwesome"
x:Class="IBMobile.Views.HomePage"
Visual="Material">
<ContentPage.IconImageSource>
<FontImageSource FontFamily="{StaticResource FontAwesomeSolid}" Glyph="{x:Static local2:IconFont.Home}" />
</ContentPage.IconImageSource>
As we all know,google release the android L,and the gmail went into more beautiful.Now I want to use this pattern like the pic,I searched it everywhere,github included, only to find that nothing.
THX deeply in advanced! Here is the pic:
oh!I'm sorry,I forget to mention that the new refresh layout,could you see the circle within a Curved arrow.swipe the screen down,and it begin to refresh,maybe it's s new swipefreshlayout,thx!
This is the new SwipeRefreshLayout class that is included in the latest support library. The implementation is exactly the same as the old support swipeRefresh layout
Here an overview:
http://www.google.com/design/spec/material-design/introduction.html
Here is explained how to use it: https://developer.android.com/training/material/index.html
I need to do animation like it is there in Recent App section in Android 5.0.
Like shown in the image below. Any hint or link or even the Animation type used here would be helpful.
Take a look here: https://github.com/vikramkakkar/DeckView
There is also an example here. You can also find about RecentsView here:
https://github.com/android/platform_frameworks_base/blob/59701b9ba5c453e327bc0e6873a9f6ff87a10391/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
I have never done this, but I can point you in the right direction to use StackView. It was added in API level 11 (Android 3.0)
I have found some examples
http://www.broculos.net/2011/12/android-101-how-to-create-stackview.html
http://www.informit.com/articles/article.aspx?p=2078060&seqNum=3
http://www.thaicreate.com/mobile/android-stackview.html
Also this library looks decent
https://github.com/blipinsk/FlippableStackView
Take a look here: https://github.com/ZieIony/MaterialRecents I personally tried it and it looks promising.
You can always look at the official Android source code.
Check the method startRecentsActivity() under packages/SystemUI from the official Android source code.
It's not a very easy-to-read code, but it's definitely the best and most reliable source if you really want to mimic the official Android Lollipop animations.
i have created a github repo with my class i hope it helps,
it's is the start i hope it helps
Stack Cards Android
it makes the same as your image
you can set the difference between cards, scale from card to card,
animation duration, number of cards of course
usage easy just include the class &
// **Paramters definitions** :
// Activity owningActivity, RelativeLayout container, int cardHeightDP, int cardDiffDP,float cardScale, int animationDuration)
StackCards stackCards = new StackCards(yourActivity.this, cardsContainer, 100, 50, (float) 0.2, 500);
//(Number of Cards, The Layout of the Card)
stackCards.initCards(7, R.layout.stack_card);
I'm novice at Xamarin and I'm trying to use ShinobiCharts in Xamarin.Android to show candlestick data on it.
Code from .axml:
<fragment
class="com.shinobicontrols.charts.ChartFragment"
android:id="#+id/chart"
android:layout_width="match_parent"
android:layout_height="match_parent" />
This is fragment where should be shown chart.
var chartFragment = (ChartFragment)FragmentManager.FindFragmentById(Resource.Id.chart);
var chart = chartFragment.ShinobiChart;
chart.SetLicenseKey("license_key");
chart.AddXAxis(new DateTimeAxis
{
GesturePanningEnabled = true,
GestureZoomingEnabled = true
});
chart.AddYAxis(new NumberAxis
{
GesturePanningEnabled = true,
GestureZoomingEnabled = true
});
var dataPoints =
quotes.Select(
quoteCandle =>
new MultiValueDataPoint(DateUtils.ConvertToJavaDate(TimeStamp.UnixToDate(quoteCandle.Timestamp)),
(double) quoteCandle.Low, (double) quoteCandle.High,
(double) quoteCandle.Open, (double) quoteCandle.Close)).ToList();
var series = new OHLCSeries { DataAdapter = new SimpleDataAdapter() };
series.DataAdapter.AddAll(dataPoints);
chart.AddSeries(series);
chart.XAxis.Style.GridlineStyle.GridlinesShown = true;
chart.YAxis.Style.GridlineStyle.GridlinesShown = true;
chart.RedrawChart();
This is code of creating ShinobiCharts.
The problem is that added series are not shown in chart. Style changed, but there are no series. What do I do wrong? I hope anyone can help.
Sorry for question, Candlestickes are not available for trial version of ShinobiControls, only for premium version.
As sammyd said, CandlestickSeries are available in the trial version of ShinobiCharts for Android (as are all the other premium features). Have you managed to get the CandlestickChart sample running? The sample is included in the download bundle.
On the face of it your code looks fine (without seeing the rest of it) but there are a couple of things I'd recommend checking:
Have you replaced the string license_key with the trial license key we would have emailed you when you downloaded the bundle? The trial license key is a a really long string of characters and digits.
Is your data coming in as expected and does it make sense (e.g. are your low values less than your open values etc.)?
I'm not sure it'll make much difference, as they're pretty much interchangeable, but you're actually creating an OHLCSeries in code but mention a CandlestickSeries
Have you set the series' style object in a way that would stop it from showing i.e. have you set it to be transparent in colour?
Are you getting an actual error, and if so what message is being logged?
Hopefully the above will help you get your candlestick chart up and running!
Edit:
If you're using the Android Emulator, your AVD needs to have GPU emulation turned on (as we use OpenGL ES 2.0 for rendering the charts). There's more information on using the emulator with OpenGL on the Android developer site.
Disclaimer: I work for ShinobiControls
I researched on this for quite a while and I know this kind of questions already answered. But I couldn't find a right answer showing how to practically deal with math formula in Android app. Without including large amount (5~20MB) of files in the Android project, it seems that there is no way to parse & display math formula script like MATHML. I looked at JEuclid and MathJax that were mentioned a lot for Android but I found them in this category.
So at this point, the only way I can think of is to take each of those formula in a image file and display it on Android. But in practice, that manual process is really slow. I am sure this is not a right way.
So I have to ask this again. How to practically display math formula in your Android app?
You can not set maths formula to TextView in android. You have to use WebView in which you can display maths formulae. See mathjax for more information.
if you want to display for android then here is library you can implement in your project. mathjaxwebview
If you want to parse Tex(Inline mode and display mode) formats and ASCII math format you can use this link .I used the above math view given in this link to display formula.It worked like a charm adding to that download mathjax from official site and get fonts folder and put it in your assets folder. It will definitely work.
https://github.com/Nishant-Pathak/MathView
download math view form above link.
The libraries which are using WebView to wrap latex-rendering-js-library (e.g., this, this and this), are not working well with the RecyclerView and will make the app slow. And they are not even updating the js libraries.
Finally, I found "noties/jlatexmath-android", which is using "opencollab/jlatexmath" native Java library. It is fast and can be easily used with RecyclerView.
Sample usage of JLatexMathView:
implementation "ru.noties:jlatexmath-android:$jlatexmath_version"
// for Cyrillic symbols
implementation "ru.noties:jlatexmath-android-font-cyrillic:$jlatexmath_version"
// for Greek symbols
implementation "ru.noties:jlatexmath-android-font-greek:$jlatexmath_version"
<ru.noties.jlatexmath.JLatexMathView
android:id="#+id/j_latex_math_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dip"
android:background="#color/white"
app:jlmv_alignVertical="center"
app:jlmv_alignHorizontal="center"
app:jlmv_textSize="16sp" />
val latexText = "\$\$f(x)=(x+a)(x+b)\$\$"
binding.jLatexMathView.setLatex(latexText)
You can also use it as an extension of "noties/Markwon", a Markdown library for Android. Details can be found here.
Sample Usage of Markwon:
implementation "io.noties.markwon:core:$markwon_version"
implementation "io.noties.markwon:ext-latex:$markwon_version"
implementation "io.noties.markwon:inline-parser:$markwon_version"
<TextView
android:id="#+id/tv_markdown"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
val markwon = Markwon.builder(requireContext())
.usePlugin(MarkwonInlineParserPlugin.create())
.usePlugin(JLatexMathPlugin.create(binding.tvMarkdown.textSize) { builder ->
// ENABLE inlines
builder.inlinesEnabled(true)
})
.build()
val latexText = "Example: \$\$f(x)=(x+a)(x+b)\$\$"
markwon.setMarkdown(binding.tvMarkdown, latexText)
You can implement with MathType.
But your data for display must be in MathType format
https://docs.wiris.com/en/mathtype/mathtype_web/sdk/mobile-apps