我的xml布局是:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#C5C6E1"
android:orientation="vertical"
tools:context=".MainActivity" >
<LinearLayout
android:id="@+id/topll"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
ads:adSize="SMART_BANNER"
ads:adUnitId=""
ads:loadAdOnCreate="true" >
</com.google.ads.AdView>
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Drag to set font size" />
<SeekBar
android:id="@+id/seekBar1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="100"
android:progress="25" />
</LinearLayout>
<RelativeLayout
android:id="@+id/ll"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/titleText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/questionTEXT"
android:textStyle="bold" />
<TextSwitcher
android:id="@+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/titlefav"
android:layout_below="@+id/titleText"
android:lines="15" >
</TextSwitcher>
<RelativeLayout
android:id="@+id/titlefav"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/adView1"
android:layout_alignParentLeft="true" >
<TextView
android:id="@+id/tipText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Swipe for more quotes"
android:textSize="14sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/fav"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:src="@drawable/f_disable" />
</RelativeLayout>
<com.google.ads.AdView
android:id="@+id/adView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
ads:adSize="SMART_BANNER"
ads:adUnitId=""
ads:loadAdOnCreate="true" >
</com.google.ads.AdView>
</RelativeLayout>
</LinearLayout>
当我尝试将文本切换器设置为: tv = (TextSwitcher) findViewById(R.id.textView1);
我得到以下异常:
android.widget.TextSwitcher 无法转换为 com.google.ads.AdView。任何想法为什么会发生这种情况?