我将尝试使用文本来表示所需的布局:
股票名称
==========
符号 | 分数
谷歌 | 76
符号和GOOG应该在一个垂直的线性布局中对它们进行分组,并且它们应该与左边的乐谱对齐,76也应该在一个垂直的线性布局中对它们进行分组,但它们应该向右对齐。
这是我的布局。我可以通过您在下面看到的方式来实现它。有谁知道我做错了什么?(这只是布局的相关部分)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/stock_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="40dp" />
</LinearLayout>
<RelativeLayout
android:id="@+id/relative_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/stock_symbol" />
<TextView
android:id="@+id/stock_symbol"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="30dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/stock_score" />
<TextView
android:id="@+id/stock_score"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="30dp" />
</LinearLayout>
</RelativeLayout>
我也尝试在内部使用android:layout_alignLeft="@+id/relative_layout"
and但没有成功。android:layout_alignRight="@+id/relative_layout"
LinearLayout