首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Android -以碎片形式显示屏幕外的按钮

Android -以碎片形式显示屏幕外的按钮
EN

Stack Overflow用户
提问于 2017-01-03 23:27:19
回答 0查看 48关注 0票数 0

我正在改变我的Android应用程序,从只有一个活动开始使用带有表格布局的片段,但底部的按钮现在已经不在屏幕上了。我已经尝试删除app:layout_scrollFlags="scroll|enterAlways"行,改成只使用enterAlways,还尝试使用android:layout_below

这是我的片段:

代码语言:javascript
运行
复制
<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"
tools:context="com.jovensprofissionais.breakfastitismytreat.fragments.PersonFragment">
<TextView
    android:id="@+id/personOfTheNextWeekTitle"
    android:layout_toStartOf="@+id/personOfTheNextWeek"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/person_of_the_next_week_title" />

<TextView
    android:id="@+id/personOfTheNextWeek"
    android:layout_alignParentEnd="true"
    android:layout_alignParentTop="true"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/person_of_the_next_week" />

<TextView
    android:id="@+id/personOfTheWeekTitle"
    android:textSize="25sp"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/person_of_the_week_title"
    android:layout_above="@+id/personOfTheWeek"
    android:layout_centerHorizontal="true" />

<TextView
    android:id="@+id/personOfTheWeek"
    android:textSize="45sp"
    android:textColor="@color/colorPrimary"
    android:layout_centerVertical="true"
    android:layout_centerHorizontal="true"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/person_of_the_week" />

<RatingBar
    android:id="@+id/ratingBar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:numStars="5"
    android:stepSize="1.0"
    android:layout_above="@+id/voteButton"
    android:layout_centerHorizontal="true"
    android:theme="@style/RatingBar"/>

<Button android:id="@+id/voteButton"
    android:text="@string/text_to_button_view"
    android:textColor="@color/colorPrimaryDark"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/colorAccent"
    android:gravity="center"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true" />

这是我的activity_main

代码语言:javascript
运行
复制
<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.support.v7.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:background="?attr/colorPrimary"
    app:layout_scrollFlags="scroll|enterAlways"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

<android.support.design.widget.TabLayout
    android:id="@+id/tabs"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:tabMode="fixed"
    app:tabGravity="fill"/>
</android.support.design.widget.AppBarLayout>

<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />

EN

回答

页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41446837

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档