我想使用网格布局制作此图像的细节部分,但我面临的问题是,当文本视图长度不同时,我的文本视图不会在彼此之下结束。我的文本视图起点是相同的结束点是不同但在这个图像布局中,它们在彼此之下结束。 例如,Vol的值比low的值更多,但两者具有相同的终点。 我如何使用网格布局实现这一目标? 这是我的代码
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:columnCount="4"
android:rowCount="4"
android:padding="8dp"
android:orientation="horizontal"
android:background="@drawable/toolbar_background">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff"
android:text="Open"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff"
android:layout_marginLeft="30dp"
android:text="36.40"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff"
android:layout_marginLeft="10dp"
android:text="MktCap"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff"
android:layout_marginLeft="30dp"
android:text="33.39B"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff"
android:layout_marginTop="10dp"
android:text="High"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff"
android:layout_marginLeft="30dp"
android:layout_marginTop="10dp"
android:text="36.95"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:text="52WkHigh"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff"
android:layout_marginLeft="30dp"
android:layout_marginTop="10dp"
android:text="42.31"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff"
android:layout_marginTop="10dp"
android:text="Low"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff"
android:layout_marginLeft="30dp"
android:layout_marginTop="10dp"
android:text="36.08"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:text="52WkLow"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff"
android:layout_marginLeft="30dp"
android:layout_marginTop="10dp"
android:text="26.15"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff"
android:layout_marginTop="10dp"
android:text="Vol"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff"
android:layout_marginLeft="30dp"
android:layout_marginTop="10dp"
android:text="19.66M"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:text="P/E"/>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff"
android:layout_marginLeft="30dp"
android:layout_marginTop="10dp"
android:text="1.25"/>
答案 0 :(得分:0)
使用
android:layout_gravity="right"
在所有textview中你想要在彼此之下结束。 你也可以添加这个
android:gravity="right"