第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

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

帶有浮動按鈕的 ScrollView

帶有浮動按鈕的 ScrollView

繁星淼淼 2022-05-12 15:10:22
我制作了一個應(yīng)用程序,其中一個活動包含兩個 TextView、一個 ImageView 和 FloatingActionButton。我想做這樣的布局。這是我的代碼。<?xml version="1.0" encoding="utf-8"?><ScrollView 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"    xmlns:app="http://schemas.android.com/apk/res-auto"    android:fillViewport="true"    tools:context=".DetailsActivity"    android:id="@+id/scrollView"    >    <android.support.design.widget.CoordinatorLayout        android:layout_width="match_parent"        android:layout_height="match_parent">    <LinearLayout        android:layout_width="match_parent"        android:layout_height="match_parent"        android:orientation="vertical"        > <!--    <ProgressBar        android:id="@+id/progressBar"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:layout_gravity="center" /> -->    <TextView        android:id="@+id/titleTextView"        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:layout_margin="15dp"        android:textSize="25sp"        android:textStyle="bold"        />    <TextView        android:id="@+id/blogContent"        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:layout_margin="16dp"        android:textSize="16sp"        />        <ImageView            android:id="@+id/youtubeThumbnailImage"            android:layout_width="match_parent"            android:layout_height="match_parent"            android:layout_marginBottom="20dp"            android:src="@mipmap/ic_launcher"            android:visibility="gone"            />這適用于android 6.0。但高于 6.0,浮動按鈕出現(xiàn)在活動的右上角。
查看完整描述

1 回答

?
慕的地10843

TA貢獻1785條經(jīng)驗 獲得超8個贊

使用 CoordinatorLayout,您應(yīng)該嘗試將 FloatingActionButtons 錨點設(shè)置為引用 LinearLayout 并layout_anchorGravity用于定位 FAB。


您的 FAB 的示例代碼:


<android.support.design.widget.FloatingActionButton

        android:id="@+id/fab"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        app:layout_anchor="@id/linearLayoutID"

        app:layout_anchorGravity="bottom|right|end"

        android:layout_margin="16dp"

        android:src="@drawable/icons8_share_480"

        />

記得為你的 LinearLayout 設(shè)置一個 ID。我用作@id/linearLayoutID占位符。


查看完整回答
反對 回復(fù) 2022-05-12
  • 1 回答
  • 0 關(guān)注
  • 160 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號