<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:color="#ff0000"/>
<item android:state_focused="true"
android:color="#0000ff"/>
<item android:color="#00ff00"/>
</selector>
Run Code Online (Sandbox Code Playgroud)
我有这个选择器,我试图用来改变Linearlayout的背景.每当我尝试应用它时,我总是收到此错误消息:
org.xmlpull.v1.XmlPullParserException:二进制XML文件行#4:标记需要一个'drawable'属性或定义drawable的子标记
显然,它希望我使用drawable属性,但我不知道如何做到这一点,并改变我想要的背景.
public class BobDatabase extends SQLiteOpenHelper{
private static final String DATABASE_NAME = "bob.db";
private static final int DATABASE_VERSION = 1;
public static final String DEFAULT_PROFILE = "default_profile";
public BobDatabase(Context context)
{
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase database)
{
createProfileTable(database);
createTimeTable(database);
createEventTable(database);
createLocationTable(database);
}
/**
* Creates a table for Profile objects, executes the string create_profile_table_sql
* contained within strings.xml
* @param database
*/
public void createProfileTable(SQLiteDatabase database)
{
database.execSQL(Resources.getSystem().getString(R.string.create_profile_table_sql));
}}
Run Code Online (Sandbox Code Playgroud)
我收到这个错误
01-14 12:20:57.591:E/AndroidRuntime(1825):引起:android.content.res.Resources $ NotFoundException:字符串资源ID#0x7f040003
导致错误的代码是createProfileTable中的单行,具体是Resources.getSystem().getString(R.string.create_profile_table_sql) …
当我单击地图标记时,我会显示一个PopupWindow.PopupWindow允许用户更改标记的位置并选择其周围的半径.如果我将focusable设置为true,我可以与PopupWindow进行交互,但不能与地图进行交互.并且,如果我将焦点设置为false,奇怪的是,我可以在PopupWindow上交互SeekBar,但Buttons和EditText都没有响应,但我可以与地图进行交互.
问题:如何使用户可以同时与PopupWindow和地图进行交互?
<LinearLayout android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/event"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText android:id="@+id/markerEventNameEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="@string/your_event_name"
android:inputType="text" />
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/radius"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView android:id="@+id/radiusTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<SeekBar android:id="@+id/radiusSeekBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp" />
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button android:id="@+id/editEventButton"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/edit_event" />
<Button android:id="@+id/cancelMarkerWindowButton"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/close" />
</LinearLayout>
</LinearLayout>
<TableLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical">
<TableRow android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center">
<ImageButton android:id="@+id/ImageButton03"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:src="@drawable/arrow_1" />
</TableRow>
<TableRow …Run Code Online (Sandbox Code Playgroud) android popupwindow android-widget google-maps-android-api-2