Fit title text on a tabbedpage xamarin forms? - xamarin.forms

Hello friends how are you?
I tell you that I have a tabbedpage that aims to show a list of elements. These elements have different states and not to saturate a listview, I decided to create a tab for each state. This works well, the only problem is that the text of the tabs titles are cut. I understand that it is because of the screen size. But I have seen apps that have multiple tabs that are hidden and when they press other tabs they appear.
In summary, how can I make the text appear complete in the tab titles? Try WidthRequest, but this does not work. I thank you for the help you can give me.
<ContentPage Title="Tab 1" MinimumWidthRequest="222" WidthRequest="222" />
<ContentPage Title="Tab 2" MinimumWidthRequest="222" WidthRequest="222" />
<ContentPage Title="Tab 3" MinimumWidthRequest="222" WidthRequest="222" />

You could reset the app:tabMode from "fixed" to "scrollable".
In Xamarin.forms, Android> Resources> layout> Tabbar.xml:
Change:
app:tabMode="fixed"
To:
app:tabMode="scrollable"
Please make sure you have the code below in your MainActivity.
TabLayoutResource = Resource.Layout.Tabbar;

Related

Change Color in DatePicker

When I try to create a DatePicker it appears all white, and only the selected date is black which I changed through the Textcolor property. The rest of the graphics appear fuchsia in my case. How can I change the rest?
This is a known bug in Forms with Dark Theme.
There was a workaround posted recently
This is a super-ugly hack, but it solved the problem for me. Based on what #stefanbogaard86 suggested, I tried using Visual="Material", but the problem I ran into was that the DatePicker entry box didn't match the rest of the form. But, he's right that using Material did fix the issue with the picker rendering. So, I found this to get the best of both visuals:
<AbsoluteLayout>
<DatePicker
AbsoluteLayout.LayoutBounds="0,0,1,1"
AbsoluteLayout.LayoutFlags="All"
Date="{Binding Birthdate}"
Format="yyyy-MM-dd"
Style="{DynamicResource DatePicker}" />
<DatePicker
AbsoluteLayout.LayoutBounds="0,0,1,1"
AbsoluteLayout.LayoutFlags="All"
Date="{Binding Birthdate}"
Format="yyyy-MM-dd"
Opacity="0"
Style="{DynamicResource DatePicker}"
Visual="Material" />
</AbsoluteLayout>
The first picker is what we want to show in the form. The second one is what we want to be clickable and show the full date picker, but we don't it shown in the form, so its opacity is zero. They're both bound to the same property, so when you change the value they both work.
Like I said, this is super-ugly, but it works.

Xamarin.Forms disable Shell TabBar font scale when selected

Is there any way to disable behavior of tab bar scaling font size for selected items on Android?
It cuts off titles when selected which is very annoying.
I could not find TabBar renderer kind of thing to change behavior on Android side.
The last item 'Notificaitons' are being cut to 'Notificatio' when it is selected.
Create a dimens.xml in Android> Resource> values. And then add the following XML to override the size of the text when it is active and not active:
<?xml version="1.0" encoding="utf-8" ?>
<resources xmlns:tools="http://schemas.android.com/tools">
<dimen name="design_bottom_navigation_text_size" tools:override="true">12sp</dimen>
<dimen name="design_bottom_navigation_active_text_size" tools:override="true">12sp</dimen>
</resources>
Before:
After:

Focusing button by default in android tv

I have an Android tv Layout with two buttons:
Buttons are not focused
I want one button to be focused by default:
Focusing choose a TV button by default.
I have tried a few methods.
In java file
final Buttonspinner spinner = findViewById(R.id.choose_folder);
spinner.requestFocus();
spinner.setFocusable(true);
In xml
android:state_focused="true"
Still, it's not getting focused by default.
How can I achieve this?
In code:
spinner.setFocusableInTouchMode(true);
spinner.setFocusable(true);
spinner.setFocusedByDefault(true);
spinner.requestFocus();
Alternatively in XML:
<Button
android:id="#+id/choose_folder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/choose"
android:focusableInTouchMode="true"
android:focusable="true"
android:focusedByDefault="true">
<requestFocus/>
</Button>
Maybe a bit overkill, but either one of these should cover all bases.

Vertical label alignment in SAPUI5 (Label too high)

I am currently working on my first SAPUI5 mobile application. I found the options for horizontal layout positioning, but my labels are shown "too high". For display I am using Google Chrome.
My page theme is sap_bluecrystal and the content structure is as follows:
sap.ui.layout.form.SimpleForm (Max Container Cols: 2)
--> sap.m.Label (Text: Name, LabelFor: "Name")
--> sap.m.Input (Id: "Name")
There are some more fields following the same structure. The result is:
Has someone an idea how to solve this problem?
Thank you in advance,
Best Regards, Jonathan
You can use the editable property like this:
<f:SimpleForm id="form"
editable="true">
<f:content>
<Label
text="Name"
labelFor="Name" />
<Input id="Name"
value="DJ" />
</f:content>
</f:SimpleForm>
That should do what you need.
Here's an example (switch the switch to turn this on and off to see the effect).

FLEX - Disable specific Tree nodes

Ey guys,
I want to disable specific nodes in a mx:Tree component.
The dataprovider is a XML file, and here is a sample of that menu:
<nav>
<menu label="Menu" action="" item="">
<menu label="Item 1" action="image" item="image.png" />
<menu label="Item 2" action="disabled" item=" " />
</menu>
</nav>
In the above example, you will get a simple menu item with two childs. I want to disable the second child (if action is set to disabled...)
How can I do this?
All I need is to simply change the font color of those items, or to make the alpha 0.5. If its possible to also disable the clicking, then thats good, but the main focus is giving them different color or opacity.
Any help is appreciated! :)
Thanks! :)
Basically that's how item renderer should looks like. However it's not going to work with xml dataprovider. I recommend you to to use collection of objects then it will work fine.
<?xml version="1.0"?>
<s:MXTreeItemRenderer xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:fx="http://ns.adobe.com/mxml/2009"
enabled="{data.action != 'disabled'}">
<s:Label text="{data.label}"
color="{data.action != 'disabled'? 0x000000:0xff0000}"/>
</s:MXTreeItemRenderer>

Resources