亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

約束布局自定義頁腳

約束布局自定義頁腳

千巷貓影 2022-08-17 16:01:08
我有一個包裹在約束布局中。custom footer<?xml version="1.0" encoding="utf-8"?><android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:app="http://schemas.android.com/apk/res-auto"    xmlns:tools="http://schemas.android.com/tools"    android:id="@+id/relativeLayout"    android:layout_width="match_parent"    android:layout_height="wrap_content"    tools:layout_editor_absoluteY="25dp">    <android.support.constraint.ConstraintLayout        xmlns:android="http://schemas.android.com/apk/res/android"        android:id="@+id/my_toolbar"        android:layout_width="0dp"        android:layout_height="50dp"        android:background="@color/white"        android:elevation="4dp"        android:theme="@style/CustomToolBarStyle"        app:layout_constraintBottom_toBottomOf="parent"        app:layout_constraintEnd_toEndOf="parent"        app:layout_constraintStart_toStartOf="parent"        app:layout_constraintTop_toTopOf="parent">        <ImageButton            android:id="@+id/imageButton"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_marginStart="8dp"            android:layout_marginLeft="8dp"            android:layout_marginTop="8dp"            android:layout_marginEnd="8dp"            android:layout_marginRight="8dp"            android:layout_marginBottom="8dp"            android:background="@null"            android:src="@drawable/ic_action_add"            app:layout_constraintBottom_toBottomOf="parent"            app:layout_constraintEnd_toStartOf="@+id/imageButton2"            app:layout_constraintHorizontal_chainStyle="spread_inside"            app:layout_constraintStart_toStartOf="parent"            app:layout_constraintTop_toTopOf="parent" />    </android.support.constraint.ConstraintLayout></android.support.constraint.ConstraintLayout>在設計規范中,它作為獨立組件看起來相當不錯。但是,當我嘗試在其他頁面中包含此頁腳時,它看起來像這樣:基本上,它們都移到了頁腳的一側。以下是實際頁面的代碼以及我包含頁腳的位置:ImageButtons
查看完整描述

1 回答

?
至尊寶的傳說

TA貢獻1789條經驗 獲得超10個贊

我修改了您的第二個xml文件,它工作正常。只需將寬度設置為include2match_parent

 <android.support.constraint.ConstraintLayout 
           xmlns:android="http://schemas.android.com/apk/res/android"
           xmlns:app="http://schemas.android.com/apk/res-auto"
           xmlns:tools="http://schemas.android.com/tools"
           android:id="@+id/linearLayout"
           android:layout_width="match_parent"
           android:layout_height="match_parent"
           tools:context=".MainActivity"
           tools:layout_editor_absoluteY="25dp">

<include
        android:id="@+id/include2"
        layout="@layout/fragment_bottom_properties_dialog"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.492"
        app:layout_constraintStart_toStartOf="parent"/>


查看完整回答
反對 回復 2022-08-17
  • 1 回答
  • 0 關注
  • 91 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號