mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +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.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);
|
||||
tv.setVisibility(android.view.View.GONE);
|
||||
return tv;
|
||||
@ -102,6 +102,9 @@ function onItemsPropertyChanged(data: dependencyObservable.PropertyChangeData) {
|
||||
if (view.color) {
|
||||
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);
|
||||
|
||||
this._listener = new android.widget.TabHost.OnTabChangeListener({
|
||||
onTabChanged: function (id: string) {
|
||||
onTabChanged: function(id: string) {
|
||||
var bar = that.get();
|
||||
if (bar) {
|
||||
bar.selectedIndex = parseInt(id);
|
||||
|
Reference in New Issue
Block a user