我有这个xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/settingsSwitchMainLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true" >
<ImageView
android:id="@+id/switch_bg"
android:layout_width="50dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_centerInParent="true"
android:layout_centerVertical="true"
android:layout_marginRight="7dp"
android:src="@drawable/switch_bg_on" />
<RelativeLayout
android:id="@+id/switch_handle"
android:layout_width="38dp"
android:layout_height="38dp"
android:layout_alignParentRight="true"
android:layout_marginRight="4dp"
android:layout_marginTop="6dp"
android:background="@drawable/switch_handle"
android:padding="0dp" >
<ImageView
android:id="@+id/switch_v"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginTop="9dp"
android:src="@drawable/switch_v"
android:visibility="visible" />
</RelativeLayout>
<com.me.view.text.MyTextView
android:id="@+id/switch_text"
style="@style/settingsText"
android:layout_centerVertical="true"
android:layout_toLeftOf="@id/switch_bg"
android:layout_alignParentLeft="true"
android:layout_marginLeft="10dp"
android:gravity="center_vertical"
android:text="Text long Text long Text long Text long Text long Text long " />
</RelativeLayout>
当我切换到graphical preview
时,看不到预览并且
我第一次遇到这个错误:
The project target is not set. Right click project, choose Properties | Android.
然后我将目标视图更改为Android 4.2.1
并得到了这个新错误
No resources match the configuration
default
Change the configuration or create:
res/layout/settings_switch.xml
You can also click the 'Create New...' item in the configuration dropdown menu above.