2011-09-15 67 views

回答

1

說實話,你的問題不是一個好問題,並不符合這裏的要求。無論如何,因爲你似乎是一個完全初學者,因爲這是你的第一個問題(歡迎!),我會提供一些信息。

你需要兩種觀點。第一個將是一個ImageView,您可以在其中顯示圖像。第二個可以是簡單的TextView,您可以在其中將文本設置爲URL。

要使它們並排顯示,您需要一個LinearLayout,並將方向設置爲水平。在該佈局中,您可以放置​​ImageView而不是TextView。這兩個視圖都應將layout_width設置爲wrap_content,並將layout_weight設置爲1

在您的活動中,您可以將圖像設置爲ImageView和TextView的URL。

下面是簡單的XML佈局:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="horizontal" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
    <ImageView 
    android:src="@drawable/icon" 
    android:layout_width="wrap_content" 
    android:layout_height="fill_parent" 
    android:layout_weight="1"/> 
    <TextView 
    android:text="dummytext" 
    android:layout_width="wrap_content" 
    android:layout_height="fill_parent" 
    android:layout_weight="1"/> 
</LinearLayout> 

一個LinearLayout tutorial可以在官方文檔,其中一個lot of views and layouts are shown and explained找到。

相關問題