今天继续学习郭少的<<第一行代码>>,读到3.3.2相对布局这一章(P102页),根据书上的实例,运行以后在控制台显示了,
Information:Gradle tasks [:app:assembleDebug]
C:\Users\Administrator\AndroidStudioProjects\UILayoutTest\app\src\main\res\layout\activity_main.xml
Error:(10, 31) No resource found that matches the given name (at 'layout_above' with value '@id/button3').
Error:(11, 34) No resource found that matches the given name (at 'layout_toLeftOf' with value '@id/button3').
Error:(17, 31) No resource found that matches the given name (at 'layout_above' with value '@id/button3').
Error:(18, 35) No resource found that matches the given name (at 'layout_toRightOf' with value '@id/button3').
好你是说没有找到与‘@id/button3‘匹配的名字的资源,怎么回事呢,仔细看了一下activity_main.xml,发现了问题
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/button3"
android:layout_toLeftOf="@id/button3"
android:text="Button 1" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/button3"
android:layout_toRightOf="@id/button3"
android:text="Button 2" />
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="Button 3" />
<Button
android:id="@+id/button4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/button3"
android:layout_toLeftOf="@id/button3"
android:text="Button 4" />
<Button
android:id="@+id/button5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/button3"
android:layout_toRightOf="@id/button3"
android:text="Button 5" />
最后读到第103页,上面清楚的写到。注意,当一个控件去引用另一个控件的id时,该控件一定要定义在引用控件的后面,不然会出现找不到id的情况。将button3写到中间了,将button3的位置放到button1上面就行了,期待大家不要犯同样的错误!
相关推荐
No resource found that matches the given name..... ....... 使用apktool-2.0.3也可以回编译,但是比如微信回编译后会增加到110M左右,很不友好。 而使用apktool-2.3.2和原包大小一样,65M左右。 基于apktool
rootroot@cm-System-Product-Name:/home/wwt/linux_r16/lichee$ ./build.sh config Welcome to mkscript setup progress All available chips: 0. sun8iw5p1 Choice: 0 All available platforms: 0. android 1. ...
The curious ones might notice that RunFromToken is attached as a resource. Have added the original source of RunFromToken as the exe's must be present in current directory when building RunAsTi. ...
final Button btn_location = (Button) findViewById(R.id.btn_location); btn_location.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-...
./configs/media_profiles.xml: not perform any checks at all. 不用修改 ./vendorsetup.sh:add_lunch_combo octopus_perf-eng ./vendorsetup.sh:add_lunch_combo octopus_perf-user 直接用cb5801搜索替换perf...
./configs/media_profiles.xml: not perform any checks at all. 不用修改 ./vendorsetup.sh:add_lunch_combo octopus_perf-eng ./vendorsetup.sh:add_lunch_combo octopus_perf-user 直接用cb5801搜索替换perf...
为了隐藏标题栏,我们需要创建一个继承自Android原生主题(如`Theme.AppCompat.Light.NoActionBar`或`Theme.Material3.DayNight.NoActionBar`,具体取决于你的Android支持库版本)的新主题。在`styles.xml`文件中...
onNewSelection@resource://devtools/client/inspector/inspector.js:1324:5 emit@resource://devtools/shared/event-emitter.js:178:15 emit@resource://devtools/shared/event-emitter.js:255:5 setNodeFront@...
rootroot@cm-System-Product-Name:/home/wwt/linux_r16/lichee$ ./build.sh config Welcome to mkscript setup progress All available chips: 0. sun8iw5p1 Choice: 0 All available platforms: 0. android 1. ...
错误如下: LookupError: ********************************************************************** Resource 'taggers/averaged_... obtain the resource: >>> nltk.download() Searched in: - 'C:\\Users\\Dr
本文详细记录了在微信小程序项目中引入vant-weapp(一种基于Vue的轻量、可靠的移动端UI框架)时所遇到的一些问题及其解决方法。以下将根据文章内容,详细阐述微信小程序中使用npm引入依赖的流程、遇到的问题以及解决...
5. The version of your subversion (client) is below 1.5.0, upgrade to 1.5.0 or above. 该错误提示的原因是客户端的软件版本低于 1.5.0。解决方法是升级本地的 Subversion 客户端软件到 1.5.0 或以上版本,以...
- error: Error: No resource found that matches the given name (at 'icon' with value '@drawable/icon'). - Should explicitly set android:allowBackup to true or false (it's true by default, and ...
The RhinoPython community is very active and offers a wonderful resource for posting questions/answers and fi nding help on just about anything!: http://python.rhino3d.com/forums/ General References ...
how to implement some of the power and resource management principles that have been discussed in the document S60 Platform: Effective Power and Resource Management (available at ...
Ensure that the machine can be connected and that it runs the rstat daemon (use rpcinfo utility for this verification). Detailed error: RPC: Failed to create RPC client. RPC-TCP: Failed to ...
you may only use these constants *after* the line that loads the extension. ;;;;;;;;;;;;;;;;;;; ; About this file ; ;;;;;;;;;;;;;;;;;;; ; PHP comes packaged with two INI files. One that is ...
drawerLayout = FindViewById(Resource.Id.drawer_layout); navigationView = FindViewById(Resource.Id.nav_view); // 设置HomeAsUpIndicator并监听点击事件 ActionBarDrawerToggle toggle = new ...
android:label="@string/app_name" android:debuggable="true"> android:name=".ImagesWidgetConfiguration" android:label="@string/app_name"> android:name="android.intent.action.MAIN" /> ...
<property name="CONSOLE_LOG_PATTERN" value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr([${springAppName:-},%X{X-B3-TraceId:-},%X{X-B3-SpanId:-},%X{X-Span-Export:-}]...