你知道是否有可能將輸入文本與圖像合併?Android - 如何合併文字和圖像?
回答
可能是你的意思是像本例中的圖像視圖您可以將一個圖標添加到列表中
經典的Android ListView控件是文本的固體,但令人鼓舞的一個普通的列表。基本上,我們 將ListView中的一串單詞放在數組中,並告訴Android使用簡單的內置 佈局將這些單詞澆注到列表中。 但是,我們可以有一個列表,其行由圖標,圖標和文本組成,請檢查 框和文本,或我們想要的任何內容。這只是向適配器提供足夠的數據給 ,並幫助適配器爲每一行創建更豐富的View對象。 例如,假設我們需要一個ListView,其條目由一個圖標 後跟一些文本組成。我們可以構建一個佈局,看起來像這樣的行,發現在res /佈局/ row.xml 在FancyLists /靜態樣本項目:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:id="@+id/selection"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:drawSelectorOnTop="false"
/>
</LinearLayout>
這種佈局使用的LinearLayout設立一行,左邊的圖標和右邊的文字( 是一個不錯的大字體)。 但是,默認情況下,Android不知道我們想用我們的 ListView的佈局。要進行連接,我們需要與前面顯示的自定義佈局的資源ID 提供我們的適配器:
public class StaticDemo extends ListActivity {
private TextView selection;
private static final String[] items={"lorem", "ipsum", "dolor",
"sit", "amet",
"consectetuer", "adipiscing", "elit", "morbi", "vel",
"ligula", "vitae", "arcu", "aliquet", "mollis",
"etiam", "vel", "erat", "placerat", "ante",
"porttitor", "sodales", "pellentesque", "augue", "purus"};
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
setListAdapter(new ArrayAdapter<String>(this,
R.layout.row, R.id.label,
items));
selection=(TextView)findViewById(R.id.selection);
}
public void onListItemClick(ListView parent, View v,
int position, long id) {
selection.setText(items[position]);
}
}
這是繼前一個ListView的樣本的總體結構。這裏的關鍵差異 是我們已經告訴ArrayAdapter我們想要使用我們的自定義佈局 (R.layout.row),並且在該自定義佈局中該單詞應該去的TextView被稱爲R.id.label 。 注意:請記住,要引用佈局(row.xml),請使用R.layout作爲佈局XML文件(R.layout.row)的基礎名稱 上的前綴。 結果是一個ListView,左邊有圖標;在這個例子中,所有圖標都是 相同,如圖13-1所示。
我上傳的圖像的基本知識,這可能需要一段時間才能顯現 – shareef 2012-08-12 09:17:56
- 1. (EMGU)如何拆分和合並圖像?
- 2. Android,將圖像和文本視圖合併到屏幕中
- 3. 在Android中合併圖像
- 4. Android合併兩張圖像,另一張合併兩張圖像
- 5. 如何合併圖像?
- 6. 在「UITextView」中合併文本和圖像
- 7. 如何在android中組合(合併)兩張照片圖像?
- 8. 如何在Web表單上合併圖像和文本?
- 9. 如何通過合併兩個圖像
- 10. 如何刷卡圖像+文字的Android
- 11. 如何將圖像和文字合併到一個blob在谷歌驅動器
- 12. 合併圖像
- 13. 圖像和文字並排居中?
- 14. 帶圖像和文字的Android ImageButton
- 15. 如何在數字微圖中將圖像的幀合併成一個圖像?
- 16. 如何合併兩個單色圖像?
- 17. Android,如何使圖像適合屏幕?
- 18. Qt圖像合併
- 19. iphone圖像合併
- 20. 合併圖像php
- 21. 如何將兩張圖像合併爲一張圖像,並將兩張圖像合併爲一張圖像,然後再將第二張圖像合成一張?
- 22. Android圖像上的文字
- 23. Android中的圖像文字
- 24. 合併facebook文件和圖像的配置文件
- 25. Android - 將圖像文件合併到電影(但不使用JMF)
- 26. 通過拖放合併(合併)圖像
- 27. 如何在php中的背景PNG圖像合併圖像
- 28. 如何合併兩個圖像iPhone與一個圖像變高
- 29. 如何合併單個圖像中的多個圖像
- 30. 的Qt:最快的合併和圖像
下可能投票是因爲你還沒有表現出這個問題 – 2012-08-12 09:06:15
任何企圖,我同意壞措辭問題暗示湖Android或壞的英朗 – shareef 2012-08-12 09:14:24