mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
SegmentedBar item titles wrapping fixed. Now similar to iOS.
This commit is contained in:
12
apps/ui-tests-app/tab-view/nowrap.xml
Normal file
12
apps/ui-tests-app/tab-view/nowrap.xml
Normal 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>
|
@ -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);
|
||||||
|
Reference in New Issue
Block a user