我有一个Android项目,一切都很好,然后当我昨天打开项目时,这一直给我这个错误
渲染问题
注意:一个或多个布局缺少layout_width或layout_height属性.大多数布局都需要这些.
属性"visibility"中的"invisible"不是有效整数(未显示109个类似错误)
提示:尝试刷新布局.
即使我开始一个新项目,我去布局,它一直给我错误.
<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:gravity="center_horizontal"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:background="@color/backgroundDark"
tools:context="coalesce.collabup.LoginActivity">
<!-- Login progress -->
<ProgressBar
android:id="@+id/login_progress"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:visibility="gone" />
<ScrollView
android:id="@+id/login_form"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/email_login_form"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/Logo"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:text="CollabUp"
android:textSize="70sp"
android:lineSpacingExtra="8sp"
android:typeface="normal"
android:textAlignment="center"
android:textStyle="normal|bold" />
<TextView
android:id="@+id/motto"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:text="Collaboration at its finest"
android:textStyle="normal|bold"
android:textAlignment="center"
android:layout_marginTop="20dp"
android:layout_marginBottom="50dp" />
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="@+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Email"
android:inputType="textEmailAddress"
android:maxLines="1"
android:singleLine="true"
android:textSize="18sp"
android:padding="10dp"
android:layout_marginBottom="10dp" />
</android.support.design.widget.TextInputLayout> …Run Code Online (Sandbox Code Playgroud) 所以我正在通过本教程
Android RecyclerView和CardView教程尝试使用recyclelerview的cardview上的这个教程.
当我在一个单独的测试应用程序中重新创建它并且它运行顺利时,一切都很好,但是当我尝试在我的主项目中实现它时它开始了产生这个错误.提前致谢
错误:(67,45)错误:不兼容的类型:视图无法转换为TextView
在客户适配器中
class PostViewHolder extends RecyclerView.ViewHolder{
TextView textname, textbody, textdate;
ImageView imageAvatar;
public PostViewHolder(View itemView)
{
super(itemView);
->these lines textname = itemView.findViewById(R.id.textname);
textbody = itemView.findViewById(R.id.textbody);
textdate = itemView.findViewById(R.id.textdate);
imageAvatar = itemView.findViewById(R.id.imageAvatar); <-
}
}
Run Code Online (Sandbox Code Playgroud)