小编Abh*_*hek的帖子

未知属性android:layout_width,layout_height,id,gravity,layout_gravity,padding

  • 在所有Android标记上获取未知属性错误.

  • 在布局XML中,自动建议不显示所有属性(如layout_width,layout_height,orientation,orientation和所有其他android属性.)

这是一个快照

在此输入图像描述

在此输入图像描述 我为解决这个问题所做的一切.

  • 清洁构建和重建
  • 删除.idea文件
  • 无效的缓存/重新启动..选项
  • 打开省电模式.

SDk是最新的.

在App Level Gridle中

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.example.abhishek.ondemandservice"
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'),     'proguard-rules.pro'
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

应用水平Gride.

buildscript {
    repositories {
        maven { url "http://dl.bintray.com/populov/maven" }
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle …
Run Code Online (Sandbox Code Playgroud)

android android-layout android-xml android-studio android-layoutparams

70
推荐指数
7
解决办法
2万
查看次数

无法解决:在ubuntu的android studio 1.4中使用junit:junit:4.12

当我在ubuntu上的android studio 1.4中创建新项目时.

当gradle的同步完成时,我收到此错误

testCompile 'junit:junit:4.12' 
Run Code Online (Sandbox Code Playgroud)

在app/build.gradle上显示消息

Error:(23, 17) Failed to resolve: junit:junit:4.12
Show in File
Show in Project Structure dialog
Run Code Online (Sandbox Code Playgroud)

// build gradle(app模块)

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"

defaultConfig {
    applicationId "com.example.abhishek.vearch"
    minSdkVersion 16
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
}
Run Code Online (Sandbox Code Playgroud)

// build gradle(项目)

//顶级构建文件,您可以在其中添加所有子项目/模块共有的配置选项.

buildscript {
repositories { …
Run Code Online (Sandbox Code Playgroud)

ubuntu android android-studio

9
推荐指数
2
解决办法
3万
查看次数

RecyclerView的行正在改组并更改Images:android

  • 其他问题的问题变更是固定的.

我的问题是当Recycler View向上和向下滚动时

  • 当快速滚动并返回到原始位置时,行项目会改变它的位置.
  • 行项目使其部分修复为背景

我在这里如何在Fragment中设置My Recycler视图.

private void setRecyclerView() {
    recyclerView.setHasFixedSize(true);
    StaggeredGridLayoutManager layoutManager =
            new StaggeredGridLayoutManager(2, 1);
    recyclerView.setLayoutManager(layoutManager);
    adapter = new TwitterTweetAdapter(getActivity());

    // setting every thing false in item animator 
    recyclerView.setItemAnimator(new RecyclerView.ItemAnimator() {

        @Override
        public void runPendingAnimations() {

        }

        @Override
        public boolean animateRemove(RecyclerView.ViewHolder viewHolder) {
            return false;
        }

        @Override
        public boolean animateAdd(RecyclerView.ViewHolder viewHolder) {
            return false;
        }

        @Override
        public boolean animateMove(RecyclerView.ViewHolder viewHolder, int i, int i2, int i3, int i4) {
            return false;
        }

        @Override
        public boolean animateChange(RecyclerView.ViewHolder viewHolder, …
Run Code Online (Sandbox Code Playgroud)

android adapter fragment android-viewholder android-recyclerview

9
推荐指数
1
解决办法
6104
查看次数

在 TextView 中显示 3 个点或截断的任何其他方法

  • 我的 TextView 标签看起来像这样

            <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:drawableEnd="@drawable/search_pickup_address"
            android:drawablePadding="@dimen/space"
            android:scrollHorizontally="false"
            android:ellipsize="end"
            android:inputType="text"
            android:maxLines="1"
            android:minLines="1" />
    
    Run Code Online (Sandbox Code Playgroud)

    在此输入图像描述

  • 我已经设置了所有这些属性

            android:scrollHorizontally="false"
            android:ellipsize="end"
            android:maxLines="1"
            android:minLines="1"
    
    Run Code Online (Sandbox Code Playgroud)
  • 由于 Single line true 方法已被弃用

            android:singleLine="true"
    
    Run Code Online (Sandbox Code Playgroud)
  • 当我使用这种方法时,点显示得很好。

     String label;
     if (string.length() >= 35) {
        label= data.substring(0, 35)+ "...";
     } else {
        label= data;
    
     }
       textView.setText(label);
    
    Run Code Online (Sandbox Code Playgroud)
  • 但是有没有像这样直接的方法

     android:singleLine="true"
    
    Run Code Online (Sandbox Code Playgroud)

xml android textview android-layout android-design-library

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

视频录制开启时,每 5 秒间隔保存一次视频(Android 操作系统)

我想在视频录制打开时每 5 秒保存一次视频。

我尝试了很多解决方案,但遇到了一个小故障,即最后保存的帧在预览中保留了大约 300 毫秒。

我认为原因在于 MediaRecorder 类中“一旦记录器停止,就需要在重新启动之前完全重新配置和准备。”

谢谢

video android video-capture saving-data video-recording

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