2016-11-18 47 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? 如果你有一些指导,或者你可以将我重定向到一个,那么我将会非常棒。 –