小编Abd*_*sae的帖子

以编程方式滚动到NestedScrollView的顶部

有没有办法以编程方式滚动到顶部NestedScrollView还通过触发父级的滚动事件?smoothScrollTo(x, y)不会将滚动事件委托给NestedScrollingParent.

android android-layout android-nestedscrollview

68
推荐指数
9
解决办法
5万
查看次数

Android Nougat:TextureView不支持显示背景drawable

我一直在我的Android应用程序中使用TextureView,它工作正常.就在最近,我在Android设备上使用Android API 25(7.1.2)测试了我的代码.相同的代码现在不起作用并抛出错误java.lang.UnsupportedOperationException: TextureView doesn't support displaying a background drawable.

我知道void setBackgroundDrawable (Drawable background)已经被弃用了很长时间,现在它已经被删除了.但我甚至不是自己设定的.

我正在使用最新的buildTools和SDK.所以,我想知道为什么没有更新textureView内部实现.

这是相关的堆栈跟踪:

java.lang.UnsupportedOperationException: TextureView doesn't support displaying a background drawable
at android.view.TextureView.setBackgroundDrawable(TextureView.java:315)
at android.view.View.setBackground(View.java:18124)
at android.view.View.<init>(View.java:4573)
at android.view.View.<init>(View.java:4082)
at android.view.TextureView.<init>(TextureView.java:159)
at com.abdulwasaetariq.xyz.ui.customView.AutoFitTextureView.<init>(AutoFitTextureView.java:24)
at com.abdulwasaetariq.xyz.ui.customView.AutoFitTextureView.<init>(AutoFitTextureView.java:20)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[...]
at java.lang.Thread.run(Thread.java:745)
Run Code Online (Sandbox Code Playgroud)

这是我如何使用我的(尚未定制)自定义TextureView:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.abdulwasaetariq.xyz.ui.activity.MainActivity">

    <com.abdulwasaetariq.xyz.ui.customView.AutoFitTextureView
        android:id="@+id/texture"
        android:layout_width="1080px"
        android:layout_height="1080px"
        android:layout_alignParentStart="true"
        android:layout_alignParentTop="true" />

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

这是我的相关AutoFitTextureView.java: enter code here

public class AutoFitTextureView extends TextureView {

private …
Run Code Online (Sandbox Code Playgroud)

android android-layout android-textureview android-7.1-nougat

25
推荐指数
2
解决办法
5956
查看次数

无法执行dex:多个dex文件定义Lbolts/AggregateException

我知道之前已经多次报告过多个dex问题,但是在我的情况下似乎没有一个解决方案可行.

安慰:

    Unable to execute dex: Multiple dex files define Lbolts/AggregateException;
    Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lbolts/AggregateException;
Run Code Online (Sandbox Code Playgroud)

其中一个流行的解决方案是从buildpath中取消标记"Android私有库"容器.我不能这样做,因为我需要的容器中还有一些库.

另一个解决方案是取消标记以.jar形式显式添加的任何重复库.我没有这样的图书馆.

我的重复库是:android-support-v7-appcompat.jar 我在这两个容器中有它(直接从sdk文件夹引用):

1.)Android私人图书馆

2.)Android依赖项

问题是我不能完全解开这两个容器中的任何一个,因为它们都包含其他必要的库.但我也无法从任何容器中删除这个重复的.jar文件.

编辑: NB当我将android-support-v7-appcompat library_project添加到我的项目时,它进入两个容器.必须有某种方式,只进入一个.

任何人都可以帮助我如何做到这一点?

截图

screenshot2(无法删除)

java android android-appcompat android-support-library bolts-framework

18
推荐指数
2
解决办法
7778
查看次数

将vuforia android SDK合并到一个新项目中

我想在我的新应用程序中使用vuforia sdk的文本识别模块.

我成功地构建并运行了他们的示例应用程序.但是,这样做显然不足以让我弄清楚如何以正确的方式开始在我的mew项目中使用vuforia android sdk.

IDE是Android Studio.我有我的vuforia帐户的许可证密钥.

有人可以帮助我开始吗?我需要开始在我自己的个人项目中使用vuforia作为库.我不想直接开始他们的示例应用程序开发.

如果问题的背景与这个特定社区的背景不符,我很抱歉.

android loadlibrary vuforia

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

在relativeLayout中依次添加几个textViews(可变宽度)

我有一个相对布局部分.在其中,我必须以编程方式添加几个可以在宽度上变化的可点击文本视图.我需要他们一个接一个地出现.如果textView的宽度不能适合当前行的剩余空间,则应以类似的方式开始在行下方填充.

我需要这样的东西: 我想要的插图

我到目前为止管理的是以下代码:

public static void updateWordsListingOnUi(final ArrayList<String> wordsList) { //TODO: incomplete and may be inefficient
    mUiHandler.post(new Runnable() {
        @Override
        public void run() {
            TextView textView;

            wordsListingContainer.removeAllViewsInLayout(); //TODO
            for (final String word : wordsList)
            {
                textView = new TextView(context);
                textView.setText(word);
                textView.setClickable(true);
                textView.setPadding(1,1,10,1);
                if (wordsList.indexOf(word)%2 == 0) {
                    textView.setBackgroundColor(context.getResources().getColor(R.color.colorPrimary));
                }
                else {
                    textView.setBackgroundColor(context.getResources().getColor(R.color.colorAccent));
                }
                textView.setId(wordsList.indexOf(word)); //give IDs from 0 - (maxSize-1)

                textView.setOnClickListener(new View.OnClickListener() {

                    @Override
                    public void onClick(View v) {
                        Toast.makeText(context, word, Toast.LENGTH_SHORT).show();
                    }
                });
                if(wordsList.indexOf(word) > 0) {
                    RelativeLayout.LayoutParams layoutParams …
Run Code Online (Sandbox Code Playgroud)

android listview android-layout android-relativelayout

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

如何通过wifi连接多个Android设备与ADB

ADB安装在计算机中,并在设备上启用USB调试.我也成功通过wifi连接了一台设备.如何连接更多设备,而不必为每个附加设备提供设备的序列号,-s如下所示:adb -s <serial> tcpip <port>

android adb usb-debugging

5
推荐指数
2
解决办法
4047
查看次数

更新到Firebase Android版本15.0.0,向用户签名

当更新com.google.firebasecom.google.android.gms11.8.015.0.0,我们的登录的用户越来越登出.在检查时,我们能够确认FirebaseAuth.getInstance().getCurrentUser()退货null.

我能够确认的其他一些事情:

  1. 这已经通过Phone Auth和Email and Password Auth确认

  2. 如果我:

    1. 使用库版本v11.8.0登录到app v1
    2. 使用库版本v15.0.0更新到app v2

    我看到自己签了OUT(如上所述).

    1. 不要在这个v2中再次登录
    2. 更新到app v3,库版本设置回v11.8.0

    我看到自己登录了.

  3. 如果我:

    1. 使用库版本v15.0.0登录到app v1
    2. 更新到app v2,库版本设置回v11.8.0

    我看到自己登录了.

    1. 现在,如果我继续,并使用库版本v15.0.0更新到app v3

    我仍然看到自己登录了.

  4. 如果我从v12.0.1升级到v15.0.0,我也能够重现这个问题
  5. 这很可能是库本身(而不是我的代码)的问题,因为我能够使用Firebase Android Auth Quickstart重现此问题

还有其他人面对这个吗?有什么我想念的吗?我是否遗漏了v15.0.0 发行说明中的​​相关内容

android firebase firebase-authentication

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

RecyclerView位于工具栏下方

问题:我有一个RecyclerViewToolbar一个CoordinatorLayout.在RecyclerView低于Toolbar但它不应该.

在此输入图像描述

问题:我怎样才能实现RecyclerViewToolbar拥有一个边界?

activity_main.xml中

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:fitsSystemWindows="true">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.ActionBar">

    <include
        android:id="@+id/toolbar_main"
        layout="@layout/toolbar"></include>

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

    <FrameLayout
        android:id="@+id/maschinelistcontainer"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)

maschine_fragment.xml

<?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">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recycler_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:clipToPadding="false"
        android:scrollbars="vertical" />

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

xml android toolbar android-recyclerview android-coordinatorlayout

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

如何从 Retool 更新 Mongodb 中的One?

Retool中到 mongodb 中 updateOne 的正确语法是什么?它们有名为“query”和“update”的字段,这些字段与 Mongodb.updateOne 文档不太一致。

重组 mongodb 查询字段

mongodb retool

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

OR运算符的WHERE子句没有给出预期的结果

我想为搜索功能编写存储过程.我有电影的一个数据库,我应该能够通过搜索一部电影Movie.Name,Movie.Producer,Movie.Director和出现Cast.Name.

CREATE PROCEDURE RetrieveSearchResults
    @tokenParam VarChar
AS
    Select *
    from 
        (Movie 
    join 
        Cast on Movie.MovieID = Cast.MovieID) 
    join 
        Actor on Actor.ActorID = Cast.ActorID
    where 
        (Movie.Name like '%' + @tokenParam + '%')
        or (Movie.Producer like '%' + @tokenParam + '%')
        or (Movie.Director like '%' + @tokenParam + '%')
        or (Actor.Name like '%' + @tokenParam + '%')
Run Code Online (Sandbox Code Playgroud)

执行时

RetrieveSearchResults 'Almighty'
Run Code Online (Sandbox Code Playgroud)

几乎所有的元组都没有像'全能'那样的文字

我错过了什么吗?

在此输入图像描述

sql sql-server select where-clause

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