7

私は最近、AppCompat 21 の新しいコンポーネントをいじり始め、マテリアル デザインを実装しました。現在、ツールバーを備えた ActionBarActivity があり、TextView アイテムの RecyclerView を含むフラグメントをホストしようとしています (Recycler をテストするためだけに)。アイテムが表示されていますが、各ビューのテキストが途切れており、リサイクラー全体が次のようにツールバーを覆っています。

説明はこちら

ご覧のとおり、3 つの TextView があります。それらのテキストは途中で途切れており、ツールバーに重なっています (私が知っているタイトルはありません)。TextView アイテム レイアウトは、フラグメントのレイアウトである RecyclerView レイアウト内に含まれています。親アクティビティには FrameLayout -> Toolbar、FrameLayout があります。Fragment をアクティビティのサブ FrameLayout に挿入しています。XML は次のとおりです。

リサイクラーの各ビュー:

<TextView
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/textview"
  android:layout_width="match_parent"
  android:layout_height="48dp"
  android:fontFamily="sans-serif"
  android:paddingTop="16dp"
  android:paddingBottom="20dp"
  android:textSize="16sp"/>

Fragment のレイアウトである Recycler レイアウト:

<android.support.v7.widget.RecyclerView
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:id="@+id/recycler_tasks"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  tools:context="stuff.MainActivity$TaskFragment">
</android.support.v7.widget.RecyclerView>

親アクティビティのレイアウト:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:id="@+id/container"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  tools:context=".MainActivity"
  tools:ignore="MergeRootFrame">

  <android.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:minHeight="?attr/actionBarSize"
    android:background="?attr/colorPrimary"
    app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>

  <FrameLayout
    android:id="@+id/fragment_container"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

</FrameLayout>

単純なものに違いないことはわかっていますが、しばらくの間、さまざまなことを試してみましたが、役に立ちませんでした。

4

2 に答える 2

9

最上位の親としてRelativeLayoutの代わりに使用します。次に、またはフラグメント コンテナーのFrameLayoutような依存関係を追加します。layout_aboveToolbarlayout_below

于 2014-11-10T16:41:48.343 に答える