2016-11-18 44 views
0

您好,我需要使用靜態文本視圖來製作像以下圖像一樣的gridview。 enter image description here需要使用兩個靜態文本字段進行GridView

我需要使它在肖像模式。我知道有很多關於如何使用兩個textview製作gridview的stackoverflow上的指南,但我無法遵循它們,並嘗試創建一個像這樣的gridview失敗了很多次。如果有人可以幫我建立一個像上面那樣的gridview,我不會把我的帖子標記爲負面,我會非常滿意。 謝謝!

編輯:我試過一個TableLayout爲了實現上述佈局和事情進展順利,除了我不能畫垂直線(分頻器)。見下圖:enter image description here

我的代碼:

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:layout_gravity="center" 
android:divider="#FF909090" 
android:orientation="horizontal" 
android:stretchColumns="1" 
android:background="@drawable/custom_background" 
android:showDividers="middle"> 
<TableRow> 
    <TextView 
     android:text="Name" 
     android:padding="3dip" /> 
    <TextView 
     android:text="Imran" 
     android:gravity="left" 
     android:padding="3dip" /> 
</TableRow> 

<View 
    android:layout_height="2dip" 
    android:background="#FF909090" /> 

<TableRow> 
    <TextView 
     android:text="Name" 
     android:padding="3dip" /> 

    <TextView 
     android:text="Test" 
     android:gravity="left" 
     android:padding="3dip" /> 
</TableRow> 

<View 
    android:layout_height="2dip" 
    android:background="#FF909090" /> 

<TableRow> 
    <TextView 
     android:text="Name" 
     android:padding="3dip" /> 

    <TextView 
     android:text="Test" 
     android:gravity="left" 
     android:padding="3dip" /> 
</TableRow> 

感謝所有幫助我的。

+1

也許只是顯示一些代碼,你試過嗎?那麼我們可以指出你有什麼問題...(屏幕也歡迎) – snachmsm

+0

@snachmsm請看我編輯的帖子。謝謝! –

回答

1

我認爲你的問題在於你需要在這裏使用GridView的假設。

您所提交的內容應該使用ListView或更好的是RecyclerView來完成。

嘗試尋找在每一行視爲一個列表項和任務將變得非常容易:-)

像這樣:

enter image description here

+0

感謝您幫助我:) –

+0

不客氣:-)如果答案解決了您的問題,請將其標記爲正確:-) – Kelevandos

+0

但是,我如何製作像上面那樣的ListView或RecyclerView exaclty? 如果你有一些指導,或者你可以將我重定向到一個,那麼我將會非常棒。 –