如何在Textview中加载长文本时解决加载时间过慢的问题?

时间:2019-03-26 03:39:36

标签: java android firebase

我有一个textview,它将从Firebase加载一个长文本(5.694个字符),并使活动冻结大约4秒钟,直到显示整个文本。

这是我的代码:

//add in pubspec.yaml
path_provider:

//import this
import 'dart:io' as io;
import 'package:path_provider/path_provider.dart';

//create Variable 
String directory = (await getApplicationDocumentsDirectory()).path;

//initstate to create directory at launch time
@override
  void initState() {
    // TODO: implement initState
    super.initState();
    createFolder();
  }

//call this method from init state to create folder if the folder is not exists
void createFolder() async {
    if (await io.Directory(directory + "/yourDirectoryName").exists() != true) {
      print("Directory not exist");
      new io.Directory(directory + "/your DirectoryName").createSync(recursive: true);
//do your work
    } else {
      print("Directoryexist");

//do your work
    }
  }

是否有一种方法可以使加载时间更快,或者是否有像滑动文本视图之类的库?

0 个答案:

没有答案