3

で表示するファイルのパス私はこのようなツールバーのファイルパスを表示する方法を探しています: アンドロイド - ツールバー

それはクリッカブルにする必要があり、それは長いパスだ場合スワイプする必要があります。 (または小さなデバイス)。

私はHorizontalScrollViewTextViewImageViewと使用することを考えましたが、これが最良の方法であるかどうかはわかりません。これを行うにはより良い(簡単な)方法がありますか?ありがとう!

編集:@aelimillのおかげで

私はRecyclerViewが水平方向に行くことができることを発見したが、私はまだいくつかの問題を抱えています。

:それはこのようなものです(私はクリック可能にカスタムリスト項目を設定した後)

しかし、私のために:あなたは、前のスクリーンショット内のテキストをクリックすると、それは、このことを示してい

(クリックアニメーションをご覧ください)

他のActionBarアイテムと同じようにサークルアニメーションを表示するにはどうすればよいですか?

+1

RecyclerViewは、このために最適である必要があります。 – aelimill

+0

@aelimill RecyclerViewが水平になることは知りませんでした。これは完璧なソリューションになります。 –

+0

LinearLayoutManager(コンテキストコンテキスト、int orientation、boolean reverseLayout) - 方向を選択できます: – aelimill

答えて

0

@ elimillが提案しているようにRecyclerViewを使用してこれを解決しました。これは私が使用したカスタムリストアイテムである:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent" 
    android:gravity="center_vertical" 
    android:id="@+id/relativeLayout"> 

    <ImageButton 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:id="@+id/imageButton" 
     android:src="@drawable/ic_keyboard_arrow_right_white_24dp" 
     android:background="@null" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentStart="true" 
     android:layout_alignTop="@+id/textView" 
     android:layout_alignBottom="@+id/textView" /> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:id="@+id/textView" 
     android:background="?android:attr/selectableItemBackgroundBorderless" 
     android:clickable="true" 
     android:focusable="true" 
     android:layout_centerVertical="true" 
     android:layout_toRightOf="@+id/imageButton" 
     android:layout_toEndOf="@+id/imageButton" 
     android:gravity="center" 
     android:textSize="16sp" 
     android:minWidth="20dp" 
     android:textColor="#ffffff" 
     android:textAppearance="?android:attr/textAppearanceLarge" /> 

</RelativeLayout> 

使用selectableItemBackground代わりselectableItemBackgroundBorderlessの前ロリポップデバイスをサポートします。 (それは円のアニメーションではありませんが、長方形のアニメーションではありません)。

関連する問題