小编san*_*adi的帖子

Flutter 中如何同时使用 SliverPersistentHeader 和 TabBarView?

我有主页SliverPersistentHeaderTabBarView喜欢下面的代码:

 @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Theme.of(context).backgroundColor,
      body: DefaultTabController(
        length: 3,
        child: NestedScrollView(
          headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
            return <Widget>[
              SliverAppBar(
                expandedHeight: 250.0,
                floating: false,
                pinned: true,
              ),
              SliverPersistentHeader(
                delegate: _SliverAppBarDelegate(
                  TabBar(
                    labelStyle: TextStyle(
                        fontFamily: 'Raleway',
                        fontSize: 17,
                        fontWeight: FontWeight.w400,
                        color: Theme.of(context).backgroundColor),
                    indicatorColor: Theme.of(context).hintColor,
                    labelColor: Theme.of(context).buttonColor,
                    unselectedLabelColor: Theme.of(context).dividerColor,
                    tabs: [
                      Tab(text: "Menu"),
                      Tab(text: "About"),
                      Tab(text: "Contact"),
                    ],
                  ),
                ),
                pinned: true,
              ),
            ];
          },
          body: TabBarView(
            children: <Widget>[MenuTab(), AboutTab(), ContactTab()],
          ),
        ), …
Run Code Online (Sandbox Code Playgroud)

listview tabbar flutter flutter-sliver

12
推荐指数
1
解决办法
8103
查看次数

如何以编程方式在所有Android版本中获取当前的CPU温度?

我正在使用此代码获取当前的CPU温度:

只见

 private float getCurrentCPUTemperature() {
    String file = readFile("/sys/devices/virtual/thermal/thermal_zone0/temp", '\n');
    if (file != null) {
      return Long.parseLong(file);
    } else {
      return Long.parseLong(batteryTemp + " " + (char) 0x00B0 + "C");

    }
  }


private byte[] mBuffer = new byte[4096];

  @SuppressLint("NewApi")
  private String readFile(String file, char endChar) {
    // Permit disk reads here, as /proc/meminfo isn't really "on
    // disk" and should be fast.  TODO: make BlockGuard ignore
    // /proc/ and /sys/ files perhaps?
    StrictMode.ThreadPolicy savedPolicy = StrictMode.allowThreadDiskReads();
    FileInputStream …
Run Code Online (Sandbox Code Playgroud)

java cpu android temp

8
推荐指数
1
解决办法
595
查看次数

如何授予应用程序清单权限?如何在 Android 上以编程方式执行此操作?

我用过这个话题

我尝试了这段代码,但没有用:

PACKAGE_NAME = context.getApplicationContext().getPackageName();

try {
  pi = context.getPackageManager().getPackageInfo(PACKAGE_NAME, PackageManager.GET_PERMISSIONS);
  for (String perm : pi.requestedPermissions) {
    Log.e("Foo", perm);
  }
} catch (Exception e) {
}
Run Code Online (Sandbox Code Playgroud)

但它无法帮助我。我有应用程序列表,我想获得在每个应用程序上使用的权限。我该如何处理?

更新: 就像照片一样,当点击“?????? ??”时,我想获得该应用程序中使用的权限。(例如在电报中:互联网、存储、通话、相机,... )

在此处输入图片说明

更新 2:

我将分享我的问题的适配器代码

我的适配器:

class AppViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {



    AppViewHolder(View itemView, Context context, List<App> apps) {
      super(itemView);
      txt_show_permission = itemView.findViewById(R.id.txt_show_permission);



      /*The String Buffer For Permissions*/
      appNameAndPermissions = new StringBuffer();
      PackageManager pm = context.getPackageManager();
      List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);
      for (ApplicationInfo applicationInfo : packages) {
        Log.d(TAG, "App: " …
Run Code Online (Sandbox Code Playgroud)

java permissions android

5
推荐指数
1
解决办法
113
查看次数

标签 统计

android ×2

java ×2

cpu ×1

flutter ×1

flutter-sliver ×1

listview ×1

permissions ×1

tabbar ×1

temp ×1