小编def*_*123的帖子

错误:错误:'drawable/delete.png' 与属性 android:background (attr) 引用不兼容|颜色

当我尝试更改android:background活动的 XML 文件时遇到了这个问题。

Information:Gradle tasks [:app:assembleDebug]
C:\Users\Valentin\AndroidStudioProjects\CedarRestaurants4\CedarRestaurants3\app\src\main\res\layout\activity_dynamic_view_ordering.xml
Error:error: 'drawable/delete' is incompatible with attribute android:background (attr) reference|color.
Error:'drawable/delete' is incompatible with attribute android:background (attr) reference|color.
Error:failed linking file resources.
Error:java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:Execution failed for task ':app:processDebugResources'.
> Failed to execute aapt
Information:BUILD FAILED in 4s
Information:7 errors
Information:0 warnings
Information:See complete output in console
Run Code Online (Sandbox Code Playgroud)

我的活动的 XML 文件: …

xml android android-layout

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

如何在 android firebase 中找到列表的大小?

我正在开发一个具有动态视图数量的活动的应用程序。我遇到的问题是我不知道如何在 Firebase 中获取数组的大小。

这是我的代码供参考:

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_confirm_order);
    parentLinearLayout = (LinearLayout) findViewById(R.id.parent_linear_layout);

    final FirebaseAuth mAuth = FirebaseAuth.getInstance();
    final DatabaseReference mCartReference = FirebaseDatabase.getInstance().getReference().child(mAuth.getCurrentUser().getUid().toString()).child("cart");
    SharedPreferences mPrefs = getSharedPreferences("label", 0);
    mString = mPrefs.getString("tabletIdNum", "default_value_if_variable_not_found");
    appContext = getApplicationContext();

    // generate items from sortedCart into Views
//  for(int i = 0; i < mCartReference.child((mString)).child("sortedCart").size(); i++){
//        generate number of views here
//    }

    Button confirmButton = findViewById(R.id.confirmOrderButton);
    confirmButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ArrayList<String> items = new ArrayList<>(); …
Run Code Online (Sandbox Code Playgroud)

android firebase firebase-realtime-database

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