I want my TextView to be removed from the screen horizontally (and also disable horizontal scrollbars), for example:

However, the XML that I have right now causes it to automatically fit into the parent element, for example:

The code
<RelativeLayout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/parentlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff">
<TextView
android:layout_marginTop="30px"
android:id="@+id/tab1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hello1"
android:textColor="#1089F9"
android:textSize="40sp"
android:layout_marginLeft="20dp"
android:layout_marginBottom="5dp"/>
<TextView
android:layout_marginTop="30px"
android:id="@+id/tab2"
android:layout_toRightOf="@+id/tab1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hello2"
android:textColor="#1089F9"
android:textSize="40sp"
android:layout_marginLeft="50dp"
android:layout_marginBottom="5dp"/>
<TextView
android:layout_marginTop="30px"
android:id="@+id/tab3"
android:layout_toRightOf="@+id/tab2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hello3"
android:textColor="#1089F9"
android:textSize="40sp"
android:layout_marginLeft="50dp"
android:layout_marginBottom="5dp"/>
</RelativeLayout>
How do I change my code to get the layout displayed in the first image ? Just cut the text if it leaves the parent.
EDIT: Tried LinearLayout. He didn't work either
<LinearLayout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/parentlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#fff"
android:orientation="horizontal">
<TextView
android:layout_marginTop="30px"
android:id="@+id/tab1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hello1"
android:textColor="#1089F9"
android:textSize="40sp"
android:layout_marginLeft="20dp"
android:layout_marginBottom="5dp"/>
<TextView
android:layout_marginTop="30px"
android:id="@+id/tab2"
android:layout_toRightOf="@+id/tab1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hello2"
android:textColor="#1089F9"
android:textSize="40sp"
android:layout_marginLeft="50dp"
android:layout_marginBottom="5dp"/>
<TextView
android:layout_marginTop="30px"
android:id="@+id/tab3"
android:layout_toRightOf="@+id/tab2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hello3"
android:textColor="#1089F9"
android:textSize="40sp"
android:layout_marginLeft="50dp"
android:layout_marginBottom="5dp"/>
</LinearLayout>
source
share