我是论坛的新手,刚刚开始学习Android应用开发.我正在阅读developer.android.com上的教程,并且已经遇到了编译错误.我在activity_main.xml上看到了这三个错误:
error: Error: String types not allowed (at 'layout_height' with value 'wrap content'). activity_main.xml
error: Error: String types not allowed (at 'layout_width' with value 'wrap content'). activity_main.xml
error: Error: String types not allowed (at 'layout_height' with value 'wrap content'). activity_main.xml
Run Code Online (Sandbox Code Playgroud)
这是我现在的activity_main.xml代码:
<LinearLayout 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"
android:orientation="horizontal"
tools:context=".MainActivity" >
<EditText android:id="@+id/edit_message"
android:layout_width="0dp"
android:layout_height="wrap content"
android:layout_weight="1"
android:hint="@string/edit_message" />
<Button
android:layout_width="wrap content"
android:layout_height="wrap content"
android:text="@string/button_send" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
它是否会抛出错误,因为wrap_content是一个不正确的语法,还是需要在其他地方声明?任何帮助将不胜感激如何解决或修复此问题.
谢谢!
我试图将这些图像链接排成一行,但遇到一些困难。如果我添加一些 CSS 参数,例如向左浮动和向右浮动,最终会将其定位在页面上奇怪的位置。
这就是我得到的:
.preview {
position: relative;
width: 300px;
height: 300px;
overflow: hidden;
}
.preview img {
width: 100%;
height: 100%;
padding: 0;
}
.preview > div {
background-color: rgba(0,0,0,0.75);
opacity: 0;
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
-webkit-transition: opacity 0.3s linear;
text-shadow: #000 1px 1px 0;
color: #ccc;
text-align: center;
}
.preview:hover > div {
display: block;
opacity: 1.0;
}
.preview > div div {
padding: 20px 40px;
}
.preview h2 {
font-size: 1.2em; …Run Code Online (Sandbox Code Playgroud)