[英]Floating Action Button wrong position in TableLayout
As you can see TableLayout
changes width of Button
, ProgressBar
and EditText
components, but does not do the same for my FloatingActionButton
. 正如您所看到的, TableLayout
更改了Button
, ProgressBar
和EditText
组件的宽度,但对于我的FloatingActionButton
却没有这样做。
In xml: 在xml中:
<RelativeLayout 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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
xmlns:app="http://schemas.android.com/apk/res-auto" >
<TableLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:stretchColumns="*" >
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<android.support.design.widget.FloatingActionButton
android:id="@+id/FloatingActionButton04"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher"
app:elevation="4dp"
app1:fabSize="mini" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/FloatingActionButton03"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher"
app:elevation="4dp" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/FloatingActionButton02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher"
app:elevation="4dp" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/FloatingActionButton01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher"
app:elevation="4dp" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/myFAB"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher"
app:elevation="4dp" />
</TableRow>
<TableRow
android:id="@+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<Button
android:id="@+id/Button04"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/Button03"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/Button02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
</TableRow>
<TableRow
android:id="@+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:progress="60" />
</TableRow>
<TableRow
android:id="@+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:text="Width OK" >
<requestFocus />
</EditText>
</TableRow>
</TableLayout>
</RelativeLayout>
About Floating Action Button 关于浮动操作按钮
A floating action button is used for a promoted action. 浮动操作按钮用于提升操作。 Only one floating action button is recommended per screen to represent the most common action. 每个屏幕仅建议使用一个浮动操作按钮来表示最常见的操作。 Hence don't use so many action buttons in one raw. 因此,不要在一个原始中使用这么多的动作按钮。 Use normal buttons instead 请改用普通按钮
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.