- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是nativescript的新手,正在开发程序大约几个月。我遇到了同样的错误,并且正在使用radList View 和Web图像缓存插件。我们获得了一个用于发送产品及其图像和大约500kb图像的API。我从他们的类别中创建选项卡,并在类别中创建每个类别的列表 View 并列出其中的产品。我的代码是这样的;
var tabView = page.getViewById("tabViewContainer");
var meal_list = config.meal_list;
meal_list.forEach(function (item) {
var items = new observable_array_1.ObservableArray();
item.meal_list.forEach(function (item2) {
items.push(new DataItemWithImage(item2.meal_id, item2.meal_name, item2.meal_cost,"http://sezginserpen.com.tr/test_image/" + item2.meal_id + ".jpg"));
// items.push(new DataItemWithImage(item2.meal_id, item2.meal_name, item2.meal_cost,"http://pngimg.com/upload/pizza_PNG7132.png"));
});
var wrapLayout = new wrapLayoutModule.WrapLayout();
var radListView = new listViewModule.RadListView();
var layoutBase = new listViewModule.ListViewGridLayout();
layoutBase.scrollDirection = "Vertical";
layoutBase.spanCount = 2;
wrapLayout.className = "item";
wrapLayout.orientation = "horizontal";
radListView.listViewLayout = layoutBase;
radListView.items = items;//<IC:WebImage stretch="fill" height="250" class="my-image-1" src="{{ image }}></IC:WebImage>
radListView.itemTemplate = '<Border xmlns:IC="nativescript-web-image-cache" borderWidth="0.5" borderColor="lightgray"><stack-layout orientation="vertical" height="250" ><IC:WebImage horizontalAlignment="center" src="{{ image }}"></IC:WebImage><stack-layout width="100%" height="50%"> <label id="product_id_label" text="{{ id }}" style="visibility: collapsed" /><label class="align_center product_label" textWrap="true" text="{{ itemName }}" /> <label class="align_center product_label" textWrap="true" style="color:lightgray" text="{{ itemDescription }}" /> <Border borderWidth="1" borderColor="green" borderRadius="2" style="height:22%;width:95%"> <label tap="add_to_basket" class="align_center" style="background-color:white;color:green;" text="Sepete Ekle" /> </Border> </stack-layout> </stack-layout> </Border>';
wrapLayout.addChild(radListView);
var tabViewItem = new tabViewModule.TabViewItem();
tabViewItem.title = item.category.category_name,
tabViewItem.view = wrapLayout;
var tabView = page.getViewById("tabViewContainer");
tabView.items.push(tabViewItem);
});
和XML类似;
<drawer:rad-side-drawer id="drawer">
<drawer:rad-side-drawer.mainContent>
<!-- Home page contents -->
<stack-layout loaded="contentLoaded">
<TabView id="tabViewContainer" selectedIndex="{{ index }}" selectedColor="#d43b2b" selectedIndexChanged="change" tabsBackgroundColor="#ffffff" >
<TabView.items>
</TabView.items>
</TabView>
</stack-layout>
</drawer:rad-side-drawer.mainContent>
<drawer:rad-side-drawer.drawerContent>
<widgets:drawer-content />
</drawer:rad-side-drawer.drawerContent>
</drawer:rad-side-drawer>
知道是什么原因造成的吗?我正在使用ımagecache,但每次都得到了。还有我的堆栈跟踪1:
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:309)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)Caused by: java.lang.OutOfMemoryError: Failed to allocate a 14745612 byte allocation with 12939040 free bytes and 12MB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.BitmapFactory.nativeDecodeByteArray(Native Method)
at android.graphics.BitmapFactory.decodeByteArray(BitmapFactory.java:763)
at org.nativescript.widgets.Async$Http$RequestResult.readResponseStream(Async.java:225)
at org.nativescript.widgets.Async$Http$HttpRequestTask.doInBackground(Async.java:303)
at org.nativescript.widgets.Async$Http$HttpRequestTask.doInBackground(Async.java:253)
at android.os.AsyncTask$2.call(AsyncTask.java:295)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
... 3 more
跟踪2:
java.lang.OutOfMemoryError: Failed to allocate a 1508364 byte allocation with 301952 free bytes and 294KB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:975)
at android.graphics.Bitmap.createBitmap(Bitmap.java:946)
at android.graphics.Bitmap.createBitmap(Bitmap.java:913)
at com.facebook.imagepipeline.memory.BitmapPool.alloc(BitmapPool.java:55)
at com.facebook.imagepipeline.memory.BitmapPool.alloc(BitmapPool.java:30)
at com.facebook.imagepipeline.memory.BasePool.get(BasePool.java:259)
at com.facebook.imagepipeline.platform.ArtDecoder.decodeStaticImageFromStream(ArtDecoder.java:137)
at com.facebook.imagepipeline.platform.ArtDecoder.decodeFromEncodedImage(ArtDecoder.java:81)
at com.facebook.imagepipeline.decoder.ImageDecoder.decodeStaticImage(ImageDecoder.java:128)
at com.facebook.imagepipeline.decoder.ImageDecoder.decodeImage(ImageDecoder.java:94)
at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder.doDecode(DecodeProducer.java:194)
at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder.access$200(DecodeProducer.java:97)
at com.facebook.imagepipeline.producers.DecodeProducer$ProgressiveDecoder$1.run(DecodeProducer.java:129)
at com.facebook.imagepipeline.producers.JobScheduler.doJob(JobScheduler.java:207)
at com.facebook.imagepipeline.producers.JobScheduler.access$000(JobScheduler.java:27)
at com.facebook.imagepipeline.producers.JobScheduler$1.run(JobScheduler.java:78)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at com.facebook.imagepipeline.core.PriorityThreadFactory$1.run(PriorityThreadFactory.java:43)
at java.lang.Thread.run(Thread.java:818)
这是另一种,与这种错误类型无关,但是我也得到了:
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.bringToFront()' on a null object reference
at com.telerik.android.primitives.widget.sidedrawer.transitions.DrawerTransitionBase.setProgress(DrawerTransitionBase.java:77)
at com.telerik.android.primitives.widget.sidedrawer.transitions.DrawerTransitionBase.onEnded(DrawerTransitionBase.java:226)
at com.telerik.android.primitives.widget.sidedrawer.transitions.DrawerTransitionBase.run(DrawerTransitionBase.java:221)
at android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationEnd(ViewPropertyAnimator.java:1119)
at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1239)
at android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:766)
at android.animation.ValueAnimator$AnimationHandler$1.run(ValueAnimator.java:801)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:920)
at android.view.Choreographer.doCallbacks(Choreographer.java:695)
at android.view.Choreographer.doFrame(Choreographer.java:628)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:906)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7229)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
关于如何捕获此类错误的任何想法?
最佳答案
下面的示例显示了如何在iOS和Android的NativeScirpt中从TabView中删除选项卡。
main-page.xml
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo">
<TabView id="tabViewContainer" loaded="tabviewLoaded">
<TabView.items>
<TabViewItem title="">
<TabViewItem.view>
<Label text="This is Label in Tab 1" />
</TabViewItem.view>
</TabViewItem>
<TabViewItem title="">
<TabViewItem.view>
<Label text="This is Label in Tab 2" />
</TabViewItem.view>
</TabViewItem>
</TabView.items>
</TabView>
</Page>
import { EventData } from "data/observable";
import { Page } from "ui/page";
import {TabView} from "ui/tab-view";
import {isAndroid, isIOS} from "platform"
export function tabviewLoaded(args:EventData){
var tabview =<any> args.object;
if(isAndroid){
var tabViewgrid = tabview._grid;
console.dump(tabViewgrid.removeViewAt(0));
}
if(isIOS){
tabview._ios.tabBar.hidden = true;
}
}
var platform_1 = require("platform");
function tabviewLoaded(args) {
var tabview = args.object;
if (platform_1.isAndroid) {
var tabViewgrid = tabview._grid;
console.dump(tabViewgrid.removeViewAt(0));
}
if (platform_1.isIOS) {
tabview._ios.tabBar.hidden = true;
}
}
exports.tabviewLoaded = tabviewLoaded;
关于android - Nativescript doInBackground被抛出并导致OutOfMemory错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39293595/
如何在 Nativescript + Angular 中实现 RadioButtons? 我试过 RadioButton 插件,但它在编译时出错。我在 stackoverflow 上看到一篇文章说要使
每当我单击 window 的 nativeScript sidekick 下载链接时,它都会将我重定向到主页。我在那里没有看到 nativescript 助手的任何下载链接。所以我寻找关于sideki
如何在 nativescript-angular 中的分段栏中添加图像图标。你能帮我解决这个问题吗
我正在寻找一个开源的 NS7 替代 nativescript 下拉菜单。有没有人有建议。我正在将我的应用程序移植到 NS7,但无法找到替代付费版本插件的插件。 最佳答案 我的解决方法是打开一个包含下拉
enter image description here如何在 android 中更改启动画面 (LaunchScreenTheme) 的状态栏图标颜色? 我尝试了下面的代码,但它不起作用。 #FFF
Nativescript 5 已发布,我正在尝试更新 tns 版本。目前它 tns --version 显示为 4.3.2。 我遵循了 https://docs.nativescript.org/re
我想将大小为 3000*4200 像素的 SD 卡中的图像调整为 250*250 大小的个人资料图片。我尝试了很多使用 android BitmapFactory 的方法,但没有任何效果。 有这个插件
我想在 NativeScript 的绝对布局中在屏幕底部放置一个元素。 我有这个代码: 我发现 Absolut
最近我在用 nativescript 编写一个应用程序,现在我遇到一个问题,我不知道如何保存用户的登录状态。比如用户第一次登录,以后就不需要登录了。那么我该如何实现呢? 最佳答案 我确实在我的应用程序
我正在尝试在我的 NativeScript 应用程序中创建具有动态行数和列数的表或数据网格。我有一些产品类别和这些类别中的一些产品。产品对其所属类别有一些规范。以下是图形卡类别产品的 JSON 示例:
我没能找到列表选择器的 NS+JS 工作示例,文档中的示例都没有 XML 示例。有人可以帮忙吗? 最佳答案 您需要做的是绑定(bind)一个 的 items属性到页面上的数组 bindingConte
我正在尝试更改 nativescript 中 progress 组件的高度,如下所示: 但是 height 属性没有效果。如何更改此组件的高度? 最佳答案 您可以使用 height 属性更改 Pr
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 想改进这个问题?将问题更新为 on-topic对于堆栈溢出。 2年前关闭。 Improve this qu
在 NativeScript 中,是否可以从 Nativescript 应用程序中启动另一个应用程序? 假设我在一个应用程序中有一个按钮,当按下它时,它会启动 Waze 导航应用程序,并带有一个位置的
你如何附加到文件而不是覆盖它? file-system module文档解释了如何写入文件: The following example writes some text to a file. It
对于NS项目,如何设置最低iOS版本。 我有IPHONEOS_DEPLOYMENT_TARGET = 8.0;在我的build.xcconfig文件中 但是在构建过程中,我收到未设置的消息。 在构建过
我想从 NativeScript 项目中的自定义组件公开一个方法。这是概念设置: 我的组件.xml ...UI markup... MyComponent.ts export function l
使用最新版本的 Nativescript,我根据文档创建了一个插件,并且在运行 tns plugin add ../nativescript-keychain 之后我收到消息 Successfully
NativeScript 中 DIV 的替代方法是什么? 如何使用内嵌内容的 block ? 最佳答案 在浏览器中,div 的行为由 display CSS 属性决定。 例如,默认为block和ver
目前有以下命令: tns cloud build android --accountId= 返回这一行:Invalid accountId index provided 您如何为您的帐户获得正确的 a
我是一名优秀的程序员,十分优秀!