如何给 Nativescript 中的 TabViewItem 宽度?
How to give width to the TabViewItem in Nativescript?
我想实现类似上面的东西,其中相机选项卡的宽度与 TabView 中的其他选项卡相比更小。
我做了三个相同大小的标签,但我不知道如何再添加一个宽度更小的标签。
您将必须更新选项卡布局中包含摄像头的本机视图的宽度。下面的代码让布局仅采用显示内容所需的宽度。
const view = nativeTabView.getChildAt(i),
layoutParams = view.getLayoutParams();
layoutParams.weight = 0;
layoutParams.width = android.widget.LinearLayout.LayoutParams.WRAP_CONTENT;
view.setLayoutParams(layoutParams);
上面的例子是用 NativeScript Core / TypeScript 写的,如果你在 Vue / Angular 上实现这个,你不需要特别注意,只要使用适当的事件绑定语法,你就可以了。
我想实现类似上面的东西,其中相机选项卡的宽度与 TabView 中的其他选项卡相比更小。
我做了三个相同大小的标签,但我不知道如何再添加一个宽度更小的标签。
您将必须更新选项卡布局中包含摄像头的本机视图的宽度。下面的代码让布局仅采用显示内容所需的宽度。
const view = nativeTabView.getChildAt(i),
layoutParams = view.getLayoutParams();
layoutParams.weight = 0;
layoutParams.width = android.widget.LinearLayout.LayoutParams.WRAP_CONTENT;
view.setLayoutParams(layoutParams);
上面的例子是用 NativeScript Core / TypeScript 写的,如果你在 Vue / Angular 上实现这个,你不需要特别注意,只要使用适当的事件绑定语法,你就可以了。