XMLレイアウト includeとmarge

インクルードするファイルはこんな感じ
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    
    <include layout="@layout/title_image"/>

</FrameLayout>
インクルードされるファイルはこんな感じ
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

   <ImageView android:layout_width="wrap_content"
               android:layout_height="wrap_content" 
               android:src="@drawable/image" />
</FrameLayout>
これだと、FrameLayoutが重なっちゃうので<marge>をつかうと良い感じに
<merge xmlns:android="http://schemas.android.com/apk/res/android">

   <ImageView android:layout_width="wrap_content"
               android:layout_height="wrap_content" 
               android:src="@drawable/image" />
</merge>

ふんどしの持ち主

コメント

このブログの人気の投稿

Pythonのソースファイルの行番号を取得したい

Raspberry Pi 3 シリアルコンソール&シリアル通信

学習リモコン「リモコソ (RIMOKOSO1)」の設定