0

This is the XML code for the TextView. However whenever a line goes out of the screen, I can't scroll horizontally.

<?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:id="@+id/activity_bleapp"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.inti.cmnb.bleapp.BLEApp">


    <HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/scrollLogger"
        >

    <TextView
        android:id="@+id/logger"
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/btnTester"
        android:scrollHorizontally="true"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:layout_alignParentTop="true" />

    </HorizontalScrollView>


    <Button
        android:id="@+id/btnTester"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_toEndOf="@+id/scrollLogger"
        android:text="SCAN"
        android:layout_alignParentStart="true" />
</RelativeLayout>

After adding the HorizontalScrollView now not only does it not scroll horizontally width is really small so I can see even less of my text.

aarelovich
  • 5,140
  • 11
  • 55
  • 106

2 Answers2

0

remove xmlns:android="http://schemas.android.com/apk/res/android" from HorizontalScrollView

 <HorizontalScrollView
        android:id="@+id/scrollLogger"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
Hanaa
  • 61
  • 1
  • 8
0

You could alternatively use this:

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Put your very long text here..."
            android:id="@+id/txtNuus"
            android:textColor="#000000"
            android:singleLine="true"
            android:ellipsize="marquee"
            android:marqueeRepeatLimit="marquee_forever"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:scrollHorizontally="true"
            android:layout_gravity="top"
            android:gravity="center_vertical"/>
instanceof
  • 1,404
  • 23
  • 30