android.widget.TextView不能转换为android.view.ViewGroup [英] android.widget.TextView cannot be cast to android.view.ViewGroup
本文介绍了android.widget.TextView不能转换为android.view.ViewGroup的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以,我不认为它是铸造成 android.view.ViewGroup
当我尝试查看我的XML在图形视图我收到此错误信息。我没有做什么实际的Java此事涉及太多。
So I don't see where it is casting it into android.view.ViewGroup
I get this error message when I try to view my xml in the graphic view. I haven't done anything to the actual java this pertains too.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffffff"
android:orientation="vertical" >
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:stretchColumns="1" >
<TableRow
android:layout_width="fill_parent"
android:layout_height="1.0dp"
android:background="@drawable/list_divider_holo_light" />
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
在这里,我累了,使这些元素的风格,它不会接受它。
Here I tired to make a style with these elements and it wouldn't accept it.
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="25dp"
android:text="@string/add_alarm"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#ff505050"
android:textSize="18.0sp" />
<Button
android:id="@+id/bSetTimer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="100.0dp"
android:text="Button" />
</TableRow>
<Button
android:id="@+id/bSetAlarm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<TextView
android:id="@+id/textView2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Small Text" >
<TableRow
android:layout_width="fill_parent"
android:layout_height="2.0dp"
android:background="@drawable/list_divider_holo_light" />
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="10dp" >
<TextView
android:layout_height="20.0dp"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="40.0dp"
android:paddingLeft="25.0dip"
android:text="@string/alarm_volume_title" />
</TableRow>
<SeekBar
android:id="@+id/default_volume_seekbar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15.0dp"
android:paddingTop="2.0dip" />
</TextView>
</TableLayout>
推荐答案
文本视图 textView2
是没有关闭(这只是收盘前表布局
),并且运行时试图将它转换为的ViewGroup
为了增加2个表中的行和搜索栏
。
The text view textView2
is not closed (it is just before closing the table layout
), and the runtime is trying to cast it to a viewgroup
in order to add the 2 table rows and seekbar
.
这篇关于android.widget.TextView不能转换为android.view.ViewGroup的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文