我已经阅读了关于echo的手册页,它告诉我-e参数将允许转义字符(例如换行符的转义n)具有其特殊含义.当我输入命令
$ echo -e 'foo\nbar'
Run Code Online (Sandbox Code Playgroud)
进入一个交互式bash shell,我得到了预期的输出:
foo
bar
Run Code Online (Sandbox Code Playgroud)
但是,当我使用相同的命令(我已尝试将此命令字符作为测试用例的字符)时,我得到以下输出:
-e foo
bar
Run Code Online (Sandbox Code Playgroud)
这就好像echo将-e解释为一个参数(因为换行仍然显示),但它也将-e解释为一个回显的字符串.这里发生了什么?如何防止-e出现?
我查看了developer.android.com并搜索了相当多的内容,但我似乎无法找到一个布局对象来执行此操作:一个语音气泡类似于其中包含按钮列表的东西,可能是如果不是所有按钮都适合屏幕宽度,则可滚动.Twitter应用程序,Handcent SMS和HTC的Sense消息应用程序都使用它,它们在所有这些中看起来或多或少相同,这使我认为它是一个标准对象.下面的图片来自Handcent.他们在用什么?

所述SQLiteDataBase.insert(字符串,字符串,ContentValues)方便的方法需要一个ContentValues包含所有的行的列值的将被插入到数据库中的对象.如果我使用的ContentValues.put()方法来建立一个ContentValues对象插入到数据库中,并任put()或insert()净化输入或做我必须做我自己?
在为行添加布局XML的按钮之前,在单击列表项时,在回调onListItemClick()中返回行ID.现在我在列表行布局中添加了一个按钮,此回调不再起作用.我读到这是正常的.我已经能够通过在我的列表行的布局XML文件中包含这种东西来获取文本和新按钮来引用新的回调:
<Button
android:onClick="newCallBackFunctionName"/>
Run Code Online (Sandbox Code Playgroud)
问题是我似乎无法找到一种方法来检索与按下的特定按钮所在的列表项对应的行ID号.在onListItemClick()的情况下,它作为回调的一部分传递,但在上面的例子中,只有被点击的View对象被传递回回调newCallBackFunctionName.我该怎么办?
*编辑:我的列表由SimpleCursorAdaptor填充,以防重要.
*编辑:我的列表和列表行XML布局如下:
列表:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/basic_linear_layout_v1">
<TextView
android:id="@+id/category_selection_page_name"
style="@style/page_heading_v1"/>
<ListView
android:id="@id/android:list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:drawSelectorOnTop="false"/>
<TextView
android:id="@id/android:empty"
style="@style/problem_text_v1"
android:text="@string/search_list_empty" />
<Button
android:id="@+id/select_category_button"
android:textSize="20sp"
android:layout_weight="10"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:onClick="reload"/>
Run Code Online (Sandbox Code Playgroud)
行:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView android:id="@+id/category_browse_name" style="@style/basic_list_item_v1"
android:layout_weight="1"
android:layout_gravity="left"
android:focusable="true"
android:clickable="true"/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="right">
<Button
android:text="..."
android:id="@+id/subcategories_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:focusable="true"
android:onClick="onSubcategoryButtonClick">
</Button>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)