android TextView: Как да избегнем прекъсвания на редове?

Опитвам се да разбера как да избегна прекъсвания на редове в TextView.

Ако линиите са твърде дълги за ширината на TextView, трябва да се появи хоризонтална лента за превъртане. Всичко, което опитах с android:scrollbars (и т.н.) се провали, винаги има прекъсвания на редове. Това е моят код за оформление:

<?xml version="1.0" encoding="utf-8"?>
<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"
tools:context="de.zpit2u.maingate.MainGate_Logs">


<TextView
    android:id="@+id/tvTitle_Logs"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:textSize="20sp"
    android:text="@string/app_logs" />



<android.support.v4.widget.SwipeRefreshLayout
    android:id="@+id/historyRefresh"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_below="@+id/tvTitle_Logs" >



    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:padding="10dp"
        android:fillViewport="false" >


        <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"
            tools:context="de.zpit2u.maingate.MainGate_Logs">

            <TextView
                android:id="@+id/tvTitle_Logs_Clients"
                android:layout_marginTop="20dp"
                android:layout_marginStart="20dp"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textSize="18sp"
                android:text="@string/logs_clients" />

            <TextView
                android:id="@+id/tvText_Logs_Clients"
                android:layout_below="@+id/tvTitle_Logs_Clients"
                android:layout_marginTop="10dp"
                android:layout_width="match_parent"
                android:layout_height="10dp"
                android:textSize="8sp"
                android:fontFamily="monospace" />

            <ProgressBar
                android:id="@+id/progressBarLogs"
                style="?android:attr/progressBarStyleSmall"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:layout_centerInParent="true" />

        </RelativeLayout>
    </ScrollView>
</android.support.v4.widget.SwipeRefreshLayout>

Second TextView (tvText_Logs_Clients) within the RelativeLayout should be horizontally scrollable.


person user3137385    schedule 16.12.2017    source източник


Отговори (1)


начинът да накарате текстовия изглед да се превърта хоризонтално.

 <HorizontalScrollView android:layout_width="match_parent"
        android:layout_height="match_parent">
        <TextView android:layout_width="40dp"
            android:layout_height="wrap_content"
            android:scrollHorizontally="true"
            android:text="Horizontal scroll view will work now"/>

    </HorizontalScrollView>
person tamtom    schedule 16.12.2017