2017-12-16 26 views
0

私はTextView内の改行を避ける方法を理解しようとしています。android TextView:改行を避けるには?

テキストビューの幅が長すぎる場合は、水平スクロールバーが表示されます。私がアンドロイドで試したすべてのもの:スクロールバーは失敗し、常に改行があります。

<?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> 

第二のTextView(tvText_Logs_Clients)RelativeLayout内で水平にスクロールする必要があります:これは私のレイアウトのコードがあります。

答えて

0

テキストビューを水平方向にスクロールさせる方法。

<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> 
+0

素晴らしい!それは動作します!どうもありがとう! – user3137385

関連する問題