我的文件layout.xmlAndroid版本:找不到父視圖
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/edit_name"
android:hint="@string/name"
/>
</android.support.design.widget.TextInputLayout>
當我試圖讓家長在活動
EditText edit_name= (EditText) view.findViewById(R.id.edit_name);
TextInputLayout textInputLayout = (TextInputLayout) edit_name.getParent();
我錯誤:
java.lang.ClassCastException:android.widget.FrameLayout不能轉換爲androi d.support.design.widget.TextInputLayout
您是否在下面檢查了我的答案,對您有用嗎? –