У меня есть пары текстовых представлений, которые я устанавливаю рядом друг с другом, а также мне нужно развернуть их по вертикали, а также, к сожалению, у меня есть одна область, которая не будет установлена правильно, что является txtView2 в соответствии с кодом на дно. Если вы посмотрите на «Просмотр топливных станций», щелкните над ним. Что я здесь пропустил? Вот мой экранный снимок.Установка нескольких текстовых представлений Android
И вот мой код для макета.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView android:id="@+id/txtViewGPS"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
android:textSize="20sp"
android:textColorLink="#FFFF00"
android:textStyle="bold"/>
<TextView android:id="@+id/txtView_5"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
android:layout_below="@+id/txtViewGPS"
android:textSize="20sp"
android:textColorLink="#FFFF00"
android:textStyle="bold"/>
<TextView android:id="@+id/textView1_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:text="To view Evacuation Routes - "
android:textSize="20sp"
android:textStyle="bold"
android:layout_marginRight="5dp"/>
<TextView android:id="@+id/txtView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:layout_toRightOf="@id/textView1_1"
android:textSize="20sp"
android:textStyle="bold"
android:layout_alignParentRight="true"/>
<TextView android:id="@+id/txtView1_5"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
android:layout_below="@+id/txtView1"
android:textSize="20sp"
android:textColorLink="#FFFF00"
android:textStyle="bold"/>
<TextView android:id="@+id/textView2_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:layout_below="@+id/txtView1_5"
android:text="To view shelters - "
android:textSize="20sp"
android:textStyle="bold"
android:layout_marginRight="5dp"/>
<TextView android:id="@+id/txtView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/txtView1"
android:text=""
android:layout_toRightOf="@id/textView2_1"
android:textSize="20sp"
android:textStyle="bold"
android:layout_alignParentRight="true"/>
<TextView android:id="@+id/txtView2_5"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
android:layout_below="@+id/txtView2_1"
android:textSize="20sp"
android:textColorLink="#FFFF00"
android:textStyle="bold"/>
<TextView android:id="@+id/textView3_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:layout_below="@+id/txtView2_5"
android:text="To view Fuel Stations - "
android:textSize="20sp"
android:textStyle="bold"
android:layout_marginRight="5dp"/>
<TextView android:id="@+id/txtView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/txtView2"
android:layout_toRightOf="@id/textView3_1"
android:text=""
android:textSize="20sp"
android:textStyle="bold"
android:layout_alignParentRight="true"/>
</RelativeLayout>
Если вы дадите им осмысленные 'id's или, по крайней мере, указать на то, что есть что, это будет легче помочь тебе. Значимые 'id' могут также вам пригодиться, когда вы пишете код – codeMagic
txtView2 и txtView2_1 - это идентификаторы, вызывающие проблемы, отображаются txtView2_1. Для просмотра топливных станций и отображения txtView2 Нажмите здесь – yams
txtView2_1 (от того, что у вас здесь) не является TextView, который отображает «Для просмотра топливных станций» – codebaum