小编Jyo*_* JK的帖子

avc: 拒绝 { read } for name="/" dev="rootfs" ino=1 scontext=u:r:untrusted_app

我无法在这里找到解决我正在尝试创建的 Android 文件管理器应用程序上的读/写问题的方法。在真实设备上运行时,我无法从 SD 卡中删除文件。

谁能指导我,我做错了什么以及如何修复权限?

我已经添加了读/写权限 AndroidManifest.xml

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

但无论如何,我收到此错误消息:

avc: denied { read } for name="/" dev="rootfs" ino=1 scontext=u:r:untrusted_app
Run Code Online (Sandbox Code Playgroud)

对于我正在使用的依赖项:

compile 'org.apache.directory.studio:org.apache.commons.io:2.4'
Run Code Online (Sandbox Code Playgroud)

完整的日志猫:

02-28 10:59:49.740 12067-12067/? W/art: Unexpected CPU variant for X86 using defaults: x86_64
02-28 10:59:49.765 12067-12067/? W/System: ClassLoader referenced unknown path: /data/app/com.example.filemanager-1/lib/x86_64
02-28 10:59:49.770 12067-12067/? I/InstantRun: Instant Run Runtime started. Android package is com.example.filemanager, real application class is com.example.filemanager.FileManager.
02-28 10:59:49.797 12067-12074/? E/art: Failed writing handshake bytes (-1 of 14): Broken pipe
02-28 10:59:49.797 12067-12074/? …
Run Code Online (Sandbox Code Playgroud)

android android-permissions

8
推荐指数
0
解决办法
2万
查看次数

YouTubePlayerView初始化失败

YouTubePlayerView在我的项目中使用过.但播放视频时出现问题.

我在一些设备上测试过,

  1. Moto棒棒糖(api 22) - >显示"不幸的是Youtube已停止"

  2. 滑动棉花糖(api 23) - > 继续加载Ad在左侧底部显示文本.但视频在它之前没有广告.并且没有错误或异常,它显示警告,因为,

W/System:ClassLoader引用未知路径:/ system/app/YouTube/lib/arm64

我在SO搜索.ClassLoader中的解决方案 引用了未知路径:/ data/app /对我不起作用.并且没有解决"视频继续加载"的问题.

我尝试了所有相关帖子的解决方案,但不适合我的情况.

我使用过Recyclerview,该项目有Youtubeplayerview,

XML

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    android:background="?android:solidColor"
    android:id="@+id/newsLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <com.google.android.youtube.player.YouTubePlayerView
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:id="@+id/video"
        android:background="#000"
        />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1.5"
        android:orientation="vertical"
        android:padding="4dp">
             <!-- other views -->
    </LinearLayout>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

Java代码,

holder.video.initialize(MyDa.YoutubeApi, new YouTubePlayer.OnInitializedListener() {
                @Override
                public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean b) {
                    youTubePlayer.setPlayerStyle(YouTubePlayer.PlayerStyle.MINIMAL);
                    youTubePlayer.loadVideo(extractYTId(nhBean.gtURL()));
                    youTubePlayer.play();
                    videoplayer=youTubePlayer;
                }

                @Override
                public void …
Run Code Online (Sandbox Code Playgroud)

android youtube-api youtubeplayer

7
推荐指数
1
解决办法
353
查看次数

如何动画RecyclerView像垂直Viewpager转换

Vertical Viewpager在我的项目中使用过.

但是有一些问题,

  1. 当页面有很多onclick()事件时,滚动太难了

  2. fling事件不会更改页面

  3. 我尝试使用手势检测器,但它没有转换就更快地更改了页面(没有调用transformPage())

  4. 当我滚动页面时,有时onclick()事件也会被触发

所以我决定use Recyclerview as Viewpager借助PagerSnapHelper.

它工作正常.但问题是,

如何更改项目时如何进行转换或动画(就像我在ViewPager中所做的那样)

例如,Viewpager中的Zoomout转换或堆栈转换.

我尝试了stackLayoutManager,但滚动并尝试此相关链接需要更多时间.它不起作用.

我研究了两个问题如何降低viewpager的滚动速度以及如何在recyclerview中进行动画制作.我没有得到它的解决方案.

谁能帮我!!!是否可能或我需要使用任何其他小部件.

编辑

我尝试了#ADM的建议,它工作正常,但不支持PagerSnapHelper.

我在上面的链接中更改了stacklayout manager,但它不支持scrollToPosition()和PagerSnapHelper.

码:

public class StackLayoutManager  extends LinearLayoutManager {

    private static final String TAG = "StackLayoutManager";

    //the space unit for the stacked item
    private int mSpace = 0;
    /**
     * the offset unit,deciding current position(the sum of  {@link #mItemWidth} and …
Run Code Online (Sandbox Code Playgroud)

android android-viewpager android-recyclerview

6
推荐指数
1
解决办法
828
查看次数

如何将线性布局孩子的高度设置为最高的孩子高度

我有四个textviewsLinear Layout它们的宽度相等,如下所示,

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/textView86" />
    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView
            android:layout_width="0dp"
            android:layout_weight="0.25"
            android:layout_height="wrap_content" />
        <TextView
            android:layout_width="0dp"
            android:layout_weight="0.25"
            android:layout_height="wrap_content" />
        <TextView
            android:layout_width="0dp"
            android:layout_weight="0.25"
            android:layout_height="wrap_content" />
        <TextView
            android:layout_width="0dp"
            android:layout_weight="0.25"
            android:layout_height="wrap_content" />
    </LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

我的问题是,文本视图应该以相同的高度显示。该文本视图的内容(文本)将以编程方式设置。我尝试过,Relative layoutwidthtextview 的不能相同。我需要高度和宽度都应该与最高的孩子相同

请指导我。谢谢!

android android-layout

4
推荐指数
1
解决办法
1564
查看次数

Recyclerview 拖放触摸

我曾经ItemTouchHelperrecyclerview. 它工作正常。但它仅适用于长按。我需要这样做onTouch

ItemTouchHelper.Callback itemTouchHelperCallback = new ItemTouchHelper.Callback() {
    public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) {
        Collections.swap(strings, viewHolder.getAdapterPosition(), target.getAdapterPosition());
        adapter.notifyItemMoved(viewHolder.getAdapterPosition(), target.getAdapterPosition());
        return true;
    }

    @Override
    public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
        //TODO
    }

   //defines the enabled move directions in each state (idle, swiping, dragging).
     @Override
     public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
         return makeFlag(ItemTouchHelper.ACTION_STATE_DRAG,
             ItemTouchHelper.DOWN | ItemTouchHelper.UP | ItemTouchHelper.START | ItemTouchHelper.END);
         }
    };
Run Code Online (Sandbox Code Playgroud)

这是我使用的代码。请帮我!!!

android android-recyclerview itemtouchhelper

3
推荐指数
1
解决办法
3262
查看次数

键盘顶部的额外空间 - Android

我不明白我的设计有什么问题。这是代码,

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    tools:context=".emi.advanced_emi.AdvancedEmiActivity">
<android.support.design.widget.CoordinatorLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_above="@id/adlayout"
    android:layout_alignParentTop="true"
    android:fitsSystemWindows="true">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/AppTheme.PopupOverlay" />

    </android.support.design.widget.AppBarLayout>

    <include layout="@layout/content_advanced_emi" />


</android.support.design.widget.CoordinatorLayout>
<RelativeLayout
    android:id="@+id/adlayout"
    android:layout_width="match_parent"
    android:layout_height="@dimen/adheight"
    android:layout_alignParentBottom="true"
    android:layout_gravity="bottom"
    android:background="@color/c5" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

content_advanced_emi 有一个滚动视图,其中有编辑文本和一些其他视图。这是代码的一部分,

<?xml version="1.0" encoding="utf-8"?>
<ScrollView
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    android:id="@+id/main_emiadvance"
    android:scrollbars="none"
    android:fillViewport="true"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout

    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <LinearLayout
        android:layout_margin="10dp"
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:weightSum="1">
        <TextView
            android:padding="5dp"
            android:gravity="center_vertical"
            android:layout_width="0dp"
            android:layout_weight="0.5"
            android:layout_height="match_parent"
            android:textColor="@color/commontext"
            android:text="Loan Amount "
            android:textStyle="bold"/>

        <EditText
            android:background="@drawable/enabled_edittext"
            android:padding="8dp"
            android:inputType="numberDecimal"
            android:id="@+id/loan"
            android:layout_width="0dp" …
Run Code Online (Sandbox Code Playgroud)

xml android android-layout

2
推荐指数
1
解决办法
1557
查看次数