我有3個動作按鈕。一個掃描按鈕和(如果某些條件被觸發)兩個「迷你裙」。 Scanbutton應位於bottom|end
的位置,其他兩個應位於其上方。 我使用自動生成的CustomView Android Studio給了我。現在我想知道如何改變我的晶圓廠的位置。我不能使用填充選項。這是因爲CustomView嗎?自定義視圖中浮動動作按鈕的填充
這是我的xml:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
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:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".SlideMenu">
<android.support.design.widget.AppBarLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_main" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/exportbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:src="@android:drawable/ic_menu_share"
android:cropToPadding="false" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/savebutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:src="@android:drawable/ic_menu_save"
android:cropToPadding="false" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/scanbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:src="@android:drawable/ic_menu_add"
android:visibility="visible" />
</android.support.design.widget.CoordinatorLayout>
感謝你這麼多!你能解釋一下CustomView的問題嗎?或者我需要一個特定的佈局來移動我的按鈕? – Rastaman
那麼當我們用戶RelativeLayout幫助我們移動按鈕,但它並不完全建議,因爲當屏幕尺寸變化時,相對性也會改變,並導致按鈕去其他地方... 在你的情況下,這不會發生按鈕1在底部,其他按鈕是相對於它... – Smaran
我發現了一個新問題。整個片段似乎都在Action Bar的後面。我認爲這取決於改變後的視圖。有任何想法嗎? http://imgur.com/H6RIziU – Rastaman