No resource found that matches the given name (at 'layout_constraintRight_toLeftOf' w
来源:互联网 发布:手机号归属地 数据库 编辑:程序博客网 时间:2024/06/03 11:34
1.错误出现
Error:(29, 46) No resource found that matches the given name (at ‘layout_constraintRight_toLeftOf’ with value ‘@id/button_send’).
大致翻译:匹配名称的资源没有发现
<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2017 haomengjie Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --><android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <EditText android:id="@+id/edit_message" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginLeft="16dp" android:layout_marginTop="16dp" android:hint="@string/edit_message" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toLeftOf="@id/button_send" app:layout_constraintTop_toTopOf="parent" /> <Button android:id="@+id/button_send" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="0dp" android:text="@string/button_send" app:layout_constraintBaseline_toBaselineOf="@id/edit_message" app:layout_constraintRight_toRightOf="parent" /></android.support.constraint.ConstraintLayout>
双击错误信息,可以定位到错误 代码行
app:layout_constraintRight_toLeftOf="@id/button_send"
android ui呢,为了方便视图与逻辑分离,故使用xml布局
xml的话,就是android解析xml布局(顺序解析),再进行渲染
@id/button_send,意为使用一个已经存在的控件id,
从代码来看,button_send没有被解析,就被使用了,
这就造成了错误。
2. 解决问题
使用时全部替换成@+id(@id ==》 @+id)
附
@id 和 @+id 区别
https://stackoverflow.com/questions/5025910/difference-between-id-and-id-in-android
Android@id和@+id区别
http://blog.sina.com.cn/s/blog_6f5641ac0101b7vq.html
阅读全文
0 0
- No resource found that matches the given name (at 'layout_constraintRight_toLeftOf' w
- Error retrieving parent for item: No resource found that matches the given name 'android:W
- error: Error: No resource found that matches the given name (at 'text' with value '@string/
- AndroidManifest.xml:10: error: Error: No resource found that matches the given name (at 'icon' with
- No resource found that matches the given name (at 'layout_toLeftOf' with value '@id/ history_child_
- Error: No resource found that matches the given name (at 'theme' with value '@style/ AppTheme').
- No resource found that matches the given name (at 'drawab' with value '@drawable/你的资源').
- No resource found that matches the given name (at 'layout_toLeftOf' with value '@id/tx_search_friend
- 报错No resource found that matches the given name (at 'title' with value '@string/action_settings'
- Error: No resource found that matches the given name (at 'layout_toLeftOf' with value '@id/p
- No resource found that matches the given name (at 'layout_toLeftOf' with value '@id/tx_search_frien
- 解决 No resource found that matches the given name (at 'layout_above' with value '@id/button3').
- No resource found that matches the given name (at 'cardBackgroundColor' with value
- Error:No resource found that matches the given name (at 'icon' with value '@mipmap/ic_launcher.9').
- 报错No resource found that matches the given name (at 'title' with value '@string/action_settings'
- No resource found that matches the given name (at 'layout_above' with value '@id/butt
- No resource found that matches the given name
- 导入文件No resource found that matches the given name
- java 序列化 与 反序列化 demo
- RN安卓极光推送
- Linux下C实现线程池
- LeetCode 153&154 Find Minimum in Rotated Sorted Array
- 虚拟机 之“三种”网络模式
- No resource found that matches the given name (at 'layout_constraintRight_toLeftOf' w
- MFC中客户区和非客户区的区别&OnPaint和OnDrawn的区别
- ToLua中list的 bug
- win10 64bit安装 redis 及 redis desktop manager 的方法
- java日常
- error C2065: 'cout' : undeclared identifier
- java编写死锁代码
- 贪心算法——狄克斯特拉算法(Greedy Algorithm
- ajax 级联操作