标签: android-4.4-kitkat

KitKat4中的存储访问框架

我只想在我的应用程序中实现此存储访问框架.

有谁可以请帮助我找到教程,或示例应用程序?

我真的不知道存储访问框架,也无法理解本教程.请有人帮帮我..我是初学者.

android android-4.4-kitkat

0
推荐指数
1
解决办法
898
查看次数

将视图置于操作栏下方

我的Android应用中有自定义相机活动.对于使用KitKat的Android设备,我需要考虑屏幕底部的可见导航栏.为此,我使用以下行来确保我的视图位于导航栏下方:

getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN );
Run Code Online (Sandbox Code Playgroud)

但是,当我这样做时,我的一个视图隐藏在操作栏后面.我试图通过在此视图中添加上边距来说明操作栏的高度,但它似乎不正确.

我究竟做错了什么?

这就是我希望视图看起来像(适用于预KitKat设备):

在此输入图像描述

这就是Kit Kat设备目前的样子(你可以看到我视图的顶部被截断): 在此输入图像描述

这是我的布局:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:gravity="left"
    android:orientation="vertical" >

    <HorizontalScrollView
        android:id="@+id/gallery_scroll_view"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:scaleType="fitXY" >

        <com.example.helperClass.PictureHorizontalLayout
            android:id="@+id/mygallery"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:scaleType="fitXY" >
        </com.example.helperClass.PictureHorizontalLayout>
    </HorizontalScrollView>

    <FrameLayout
        android:id="@+id/camerapreview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@color/black" />   

    <LinearLayout
        android:id="@+id/button_holder_customized_cam"
        android:layout_width="match_parent"
        android:layout_height="55dp"
        android:layout_alignParentBottom="true"
        android:background="#838B8B"
        android:gravity="bottom"
        android:orientation="horizontal"
        android:weightSum="0.9"
        >

        <ImageButton
            android:id="@+id/gallery_customized_camera"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_marginRight="1dp"
            android:layout_weight="0.3"
            android:adjustViewBounds="true"
            android:background="@null"
            android:contentDescription="@string/add"
            android:maxWidth="75dp"
            android:scaleType="center"
            android:src="@drawable/ic_action_picture" >

            <!-- android:background="@drawable/custom_button_blue" -->

        </ImageButton>

        <ImageButton
            android:id="@+id/shutter_customized_camera"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_marginRight="1dp"
            android:layout_weight="0.3"
            android:adjustViewBounds="true"
            android:background="@drawable/custom_button_blue"
            android:contentDescription="@string/add" …
Run Code Online (Sandbox Code Playgroud)

android android-actionbar android-4.4-kitkat

0
推荐指数
1
解决办法
1572
查看次数

Android写入外部存储(权限被拒绝)

我面临一个糟糕的问题。我似乎无法将我的应用写入外部存储(或任何地方)。该应用程序在具有已知SD卡问题的Android 4.4.4 KitKat设备上运行。但是我的其他应用程序(针对较低的Android版本编译)仍然可以写入此设备上的外部存储设备。我已设置正确的权限。有人可以回答如何解决此问题。

堆栈跟踪:

java.io.FileNotFoundException: /storage/emulated/0/tb_Totaal.txt: open failed: EACCES (Permission denied)
Run Code Online (Sandbox Code Playgroud)

码:

File directoryFile = new File(Environment.getExternalStorageDirectory(), "");
directoryFile.mkdirs();

File f = new File(Environment.getExternalStorageDirectory(), "/text.txt");
FileWriter writer = new FileWriter(f.getPath());
Run Code Online (Sandbox Code Playgroud)

权限:

<uses-permission android:name="android.permission.write_external_storage"/>
<uses-permission android:name="android.permission.read_external_storage"/>
Run Code Online (Sandbox Code Playgroud)

android android-4.4-kitkat

0
推荐指数
1
解决办法
6597
查看次数

Android上的Cordova应用程序 - 屏幕可能无法入睡

我正在使用cordova构建Android应用程序.此应用程序应以全屏模式运行,屏幕可能永远不会关闭.我对设备进行了完全的根控制 - 所有这些都安装在Android 4.4上 - 安装了应用程序.

我已经设定

Developer options -> Stay awake -> checked

并在

Display->Sleep

我设置了最高值,即30分钟.这些设备都连接到它们的电源上.

我的config.xml如下所示:

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.project.name" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>Project </name>
    <description>
      Project
    </description>
    <author email="my@email.com">
      Test
    </author>
    <content src="index.html" />
    <plugin name="cordova-plugin-whitelist" spec="1" />
    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <platform name="android">
      <allow-intent href="market:*" />
      <splash src="res/screen/android/test.png" />
      <preference name="Fullscreen" value="true" />
      <preference name="KeepRunning" value="true"/> …
Run Code Online (Sandbox Code Playgroud)

android cordova android-4.4-kitkat

0
推荐指数
1
解决办法
1878
查看次数

不幸的是,相机已停止在Kitkat工作

我正在尝试整合在Android中拍照.在运行我正在运行的应用程序并且错误" 不幸的是,相机已停止 ",但我的应用程序没有崩溃.我在Android"KITKAT"中发现了这个问题.这是我用来拍照的示例代码,

使用这个功能我正在拍照,

private void take_picture_intent() {
        Intent takePictureIntent = (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT)
                ? new Intent(MediaStore.ACTION_IMAGE_CAPTURE_SECURE)
                : new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        if (takePictureIntent.resolveActivity(this.getActivity().getPackageManager()) != null) {
            File photoFile = null;
            try {
                photoFile = createImageFile();
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (photoFile != null) {
                photoURI = FileProvider.getUriForFile(this.getActivity(), "com.android.myapplication.fileprovider", photoFile);
                Log.e(TAG, "photoFile: "+photoFile+" ,URI : "+photoURI.getPath());
                takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
                getActivity().startActivityForResult(takePictureIntent, SelectMedia.IMAGE_CAPTURE_AT_THE_DOOR);
            }
        }
    }
Run Code Online (Sandbox Code Playgroud)

此函数用于生成图像路径,

private File createImageFile() throws IOException {
        // Create an image file name
        String timeStamp = …
Run Code Online (Sandbox Code Playgroud)

android android-camera android-4.4-kitkat

0
推荐指数
1
解决办法
858
查看次数