Error: No resource found that matches the given name (at 'layout_toLeftOf' with value '@id/p
2016-12-09 10:14
549 查看
在使用RelativeLayout布局的时候出现的错误,主要原因还是对于布局的细节原理不够理解,思维固定:
错误代码:
报错:Error:No resource found that matches the given name (at 'layout_toLeftOf' with value '@id/paly_activity_next').
原因: 在相对布局中使用 Layout_toLeftOf等属性的时候,一定要先将参照物先写在别的空件之前的位置,否者会出现找不到参照物名称的错误。
若打算①②③顺序排列的图片,若先以③为参照物,需先将③控件写出。即在写的时候顺序为③②①
错误代码:
<RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <!--①--> <ImageView android:id="@+id/play_activity_pre" android:layout_width="40dp" android:layout_height="40dp" android:background="@mipmap/prev" /> <!--②--> <ImageView android:id="@+id/play_activity_play" android:layout_width="40dp" android:layout_height="40dp" android:layout_toLeftOf="@id/paly_activity_next" android:background="@mipmap/play" /> <!--③--> <ImageView android:id="@+id/paly_activity_next" android:layout_width="40dp" android:layout_height="40dp" android:background="@mipmap/next" android:layout_alignParentRight="true" android:layout_marginRight="15dp" />
报错:Error:No resource found that matches the given name (at 'layout_toLeftOf' with value '@id/paly_activity_next').
原因: 在相对布局中使用 Layout_toLeftOf等属性的时候,一定要先将参照物先写在别的空件之前的位置,否者会出现找不到参照物名称的错误。
若打算①②③顺序排列的图片,若先以③为参照物,需先将③控件写出。即在写的时候顺序为③②①
相关文章推荐
- Error:(26, 34) No resource found that matches the given name (at 'layout_toLeftOf' with value '@id/b
- 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 'layout_toLeftOf' with value '@id/tx_search_frien
- No resource found that matches the given name (at 'layout_toLeftOf' with value '@id/ history_child_
- 怎样解决错误:error: Error: No resource found that matches the given name (at 'layout_toLeftOf' with value
- No sources that matches the given name (at 'layout_toLeftOf' with value '@id/
- Android布局问题: No resource found that matches the given name (at 'layout_above' with value @id/tv)
- No resource found that matches the given name (at 'layout_above' with value '@id/butt
- 找不R文件切且报 no resource found that matches the given name(“at ' layout_above ' with value ' @id/text_p'
- No resource found that matches the given name (at 'layout_constraintRight_toLeftOf' w
- 关于error: Error: No resource found that matches the given name (at 'text' with value '@string/hello')
- 布局文件XML编译报错 no resource found that matches the given name(at layout_above with value ...)
- error: Error: No resource found that matches the given name (at 'text' with value '@string/
- Error:No resource found that matches the given name (at 'icon' with value '@mipmap/ic_launcher.9').
- 关于Android报错:error: Error: No resource found that matches the given name (at 'label' with value)
- Error: No resource found that matches the given name (at 'theme' with value '@style/ AppTheme').
- Android studio b Error: No resource found that matches the given name (at 'src' with value '@dra...
- 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 'drawab' with value '@drawable/你的资源').
- error: Error: No resource found that matches the given name (at 'layout_above' with value '@id/btnLayout').