ViewPager叠加在fab之上。如何将晶圆厂放在首位?
的xml:
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:clickable="true"
android:src="@drawable/ic_add"
android:visibility="visible" />
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:contextClickable="true">
<android.support.design.widget.TabLayout
android:id="@+id/personal_tasks_tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabSelectedTextColor="#deFFFFFF"
app:tabTextColor="#81ffffff"
app:tabGravity="fill" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/personal_tasks_viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
或许这不是原因?只是没有按下按钮,但当我在上面时,标签会翻过来。
答案 0 :(得分:3)
// Create Variable list
var variables = new List<Variable>
{
new Variable
{
Label = "The variable Label",
ValueLabels = new Dictionary<double, string>
{
{1, "Label for 1"},
{2, "Label for 2"},
},
Name = "avariablename_01",
PrintFormat = new OutputFormat(FormatType.F, 8, 2),
WriteFormat = new OutputFormat(FormatType.F, 8, 2),
Type = DataType.Numeric,
Width = 10,
MissingValueType = MissingValueType.NoMissingValues
},
new Variable
{
Label = "Another variable",
ValueLabels = new Dictionary<double, string>
{
{1, "this is 1"},
{2, "this is 2"},
},
Name = "avariablename_02",
PrintFormat = new OutputFormat(FormatType.F, 8, 2),
WriteFormat = new OutputFormat(FormatType.F, 8, 2),
Type = DataType.Numeric,
Width = 10,
MissingValueType = MissingValueType.OneDiscreteMissingValue
}
};
// Set the one special missing value
variables[1].MissingValues[0] = 999;
// Default options
var options = new SpssOptions();
using (FileStream fileStream = new FileStream("data.sav", FileMode.Create, FileAccess.Write))
{
using (var writer = new SpssWriter(fileStream, variables, options))
{
// Create and write records
var newRecord = writer.CreateRecord();
newRecord[0] = 15d;
newRecord[1] = 15.5d;
writer.WriteRecord(newRecord);
newRecord = writer.CreateRecord();
newRecord[0] = null;
newRecord[1] = 200d;
writer.WriteRecord(newRecord);
writer.EndFile();
}
}
就像一个超级CoordinatorLayout
,所以如果您在顶部放置FrameLayout
,然后添加FAB
,ViewPager
将覆盖ViewPager
/叠加上一个视图。你可以尝试将你的FAB移到底部。
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:contextClickable="true">
<android.support.design.widget.TabLayout
android:id="@+id/personal_tasks_tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabSelectedTextColor="#deFFFFFF"
app:tabTextColor="#81ffffff"
app:tabGravity="fill" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/personal_tasks_viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:clickable="true"
android:src="@drawable/ic_add"
android:visibility="visible" />
</android.support.design.widget.CoordinatorLayout>
您还可以尝试将FAB
锚定到ViewPager
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
app:layout_anchor="@id/personal_tasks_viewpager"
app:layout_anchorGravity="bottom|end"
</android.support.design.widget.CoordinatorLayout>