SegmentedBar item titles wrapping fixed. Now similar to iOS.

This commit is contained in:
Vladimir Enchev
2016-04-14 09:36:08 +03:00
parent efe9ff90de
commit c7c593395d
2 changed files with 17 additions and 2 deletions

View File

@ -0,0 +1,12 @@
<Page>
<StackLayout>
<SegmentedBar>
<SegmentedBar.items>
<SegmentedBarItem title="Incomplete" />
<SegmentedBarItem title="Complete" />
<SegmentedBarItem title="Something Else" />
<SegmentedBarItem title="All" />
</SegmentedBar.items>
</SegmentedBar>
</StackLayout>
</Page>

View File

@ -58,7 +58,7 @@ function onItemsPropertyChanged(data: dependencyObservable.PropertyChangeData) {
tab.setIndicator(newItems[i].title || ""); tab.setIndicator(newItems[i].title || "");
tab.setContent(new android.widget.TabHost.TabContentFactory({ tab.setContent(new android.widget.TabHost.TabContentFactory({
createTabContent: function (tag: string): android.view.View { createTabContent: function(tag: string): android.view.View {
var tv = new android.widget.TextView(view._context); var tv = new android.widget.TextView(view._context);
tv.setVisibility(android.view.View.GONE); tv.setVisibility(android.view.View.GONE);
return tv; return tv;
@ -102,6 +102,9 @@ function onItemsPropertyChanged(data: dependencyObservable.PropertyChangeData) {
if (view.color) { if (view.color) {
t.setTextColor(view.color.android); t.setTextColor(view.color.android);
} }
t.setSingleLine(true);
t.setEllipsize(android.text.TextUtils.TruncateAt.END);
} }
} }
} }
@ -158,7 +161,7 @@ export class SegmentedBar extends common.SegmentedBar {
var that = new WeakRef(this); var that = new WeakRef(this);
this._listener = new android.widget.TabHost.OnTabChangeListener({ this._listener = new android.widget.TabHost.OnTabChangeListener({
onTabChanged: function (id: string) { onTabChanged: function(id: string) {
var bar = that.get(); var bar = that.get();
if (bar) { if (bar) {
bar.selectedIndex = parseInt(id); bar.selectedIndex = parseInt(id);