如何在登录活动中自定义标题栏

阿克什瓦尔·贾(Akeshwar Jha)

我正在尝试为我的应用程序创建一个登录页面。在Android-studio中创建活动时,我从选项中选择了登录活动。这就是我得到的:

在此处输入图片说明

我可以从activity_login.xml文件中自定义电子邮件/密码字段和登录按钮。但是,我还需要自定义标题栏-例如,将标题居中对齐,向标题栏添加后退按钮以及一些颜色修改。

问题是我找不到在任何地方进行修改的选项。这是activity_login.xml文件的样子:

<LinearLayout 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:gravity="center_horizontal"
android:orientation="vertical" 
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=".LoginActivity">

<!-- Login progress -->
<ProgressBar android:id="@+id/login_progress" style="?android:attr/progressBarStyleLarge"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"
    android:layout_marginBottom="8dp" 
    android:visibility="gone" />

<ScrollView android:id="@+id/login_form" 
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout 
        android:id="@+id/email_login_form" 
        android:layout_width="match_parent"
        android:layout_height="wrap_content" 
        android:orientation="vertical">

        <android.support.design.widget.TextInputLayout 
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <AutoCompleteTextView 
                android:id="@+id/email" 
                android:layout_width="match_parent"
                android:layout_height="wrap_content" 
                android:hint="@string/prompt_email"
                android:inputType="textEmailAddress" 
                android:maxLines="1"
                android:singleLine="true" />

        </android.support.design.widget.TextInputLayout>

        <android.support.design.widget.TextInputLayout 
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <EditText android:id="@+id/password" 
                android:layout_width="match_parent"
                android:layout_height="wrap_content" 
                android:hint="@string/prompt_password"
                android:imeActionId="@+id/login"
                android:imeActionLabel="@string/action_sign_in_short"
                android:imeOptions="actionUnspecified" 
                android:inputType="textPassword"
                android:maxLines="1" 
                android:singleLine="true" />

        </android.support.design.widget.TextInputLayout>

        <Button android:id="@+id/email_sign_in_button" style="?android:textAppearanceSmall"
            android:layout_width="match_parent" 
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp" 
            android:text="@string/action_sign_in"
            android:textStyle="bold" />

    </LinearLayout>
</ScrollView>

艾奥恩·沙尔瓦兹(Ioane Sharvadze)

您应该在'styles.xml'中使用'NoActionBar'样式。比在布局中创建工具栏并将子视图添加到工具栏,设置标题并根据需要进行修改。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

如何在Android的自定义标题栏中添加菜单和设置选项?

来自分类Dev

如何在Kivy中创建自定义标题栏?

来自分类Dev

如何更改多个活动的自定义窗口标题栏及其图标

来自分类Dev

如何更改多个活动的自定义窗口标题栏及其图标

来自分类Dev

使用 Prism 和自定义标题栏时如何在 MasterDetail 页面中显示菜单

来自分类Dev

自定义图片作为标题栏中的图标

来自分类Dev

NSWindow的自定义标题栏

来自分类Dev

NSWindow标题栏自定义

来自分类Dev

ionic:如何向标题栏添加自定义元素或如何为每个视图添加自己的标题栏?

来自分类Dev

如何删除活动中的标题栏?

来自分类Dev

在自定义标题栏上设置标题文本

来自分类Dev

Android:使用“自定义ListAdapter”视图在“自定义标题栏”中未显示标题

来自分类Dev

在我的自定义标题栏出现之前显示的默认标题栏

来自分类Dev

Android标题栏自定义视图不拉伸

来自分类Dev

获取双重自定义标题栏

来自分类Dev

如何自定义电子应用程序的窗口标题栏?

来自分类Dev

如何使无边界表单在自定义标题栏上可拖动?

来自分类Dev

Android首选项屏幕中的自定义标题栏

来自分类Dev

向MetroWindow标题栏中的图标添加自定义样式

来自分类Dev

自定义标题栏不在Android中的TabHost上方

来自分类Dev

我想在qt中创建一个自定义标题栏

来自分类Dev

Powershell + Windows Terminal:在标题栏中显示路径并自定义提示

来自分类Dev

如何在主要活动中隐藏标题栏:我正在使用Android Studio

来自分类Dev

如何在GNOME中更改活动窗口标题栏的颜色?

来自分类Dev

如何从android活动中删除标题栏?

来自分类Dev

如何在 Woocommerce 我的帐户侧边栏中添加新的自定义标题?

来自分类Dev

WPF如何获得最大化/最小化按钮图标-自定义标题栏

来自分类Dev

在Android中自定义标题栏。获取异常您需要使用Theme.AppCompat主题

来自分类Dev

如何在Android的标题栏中隐藏应用名称?

Related 相关文章

  1. 1

    如何在Android的自定义标题栏中添加菜单和设置选项?

  2. 2

    如何在Kivy中创建自定义标题栏?

  3. 3

    如何更改多个活动的自定义窗口标题栏及其图标

  4. 4

    如何更改多个活动的自定义窗口标题栏及其图标

  5. 5

    使用 Prism 和自定义标题栏时如何在 MasterDetail 页面中显示菜单

  6. 6

    自定义图片作为标题栏中的图标

  7. 7

    NSWindow的自定义标题栏

  8. 8

    NSWindow标题栏自定义

  9. 9

    ionic:如何向标题栏添加自定义元素或如何为每个视图添加自己的标题栏?

  10. 10

    如何删除活动中的标题栏?

  11. 11

    在自定义标题栏上设置标题文本

  12. 12

    Android:使用“自定义ListAdapter”视图在“自定义标题栏”中未显示标题

  13. 13

    在我的自定义标题栏出现之前显示的默认标题栏

  14. 14

    Android标题栏自定义视图不拉伸

  15. 15

    获取双重自定义标题栏

  16. 16

    如何自定义电子应用程序的窗口标题栏?

  17. 17

    如何使无边界表单在自定义标题栏上可拖动?

  18. 18

    Android首选项屏幕中的自定义标题栏

  19. 19

    向MetroWindow标题栏中的图标添加自定义样式

  20. 20

    自定义标题栏不在Android中的TabHost上方

  21. 21

    我想在qt中创建一个自定义标题栏

  22. 22

    Powershell + Windows Terminal:在标题栏中显示路径并自定义提示

  23. 23

    如何在主要活动中隐藏标题栏:我正在使用Android Studio

  24. 24

    如何在GNOME中更改活动窗口标题栏的颜色?

  25. 25

    如何从android活动中删除标题栏?

  26. 26

    如何在 Woocommerce 我的帐户侧边栏中添加新的自定义标题?

  27. 27

    WPF如何获得最大化/最小化按钮图标-自定义标题栏

  28. 28

    在Android中自定义标题栏。获取异常您需要使用Theme.AppCompat主题

  29. 29

    如何在Android的标题栏中隐藏应用名称?

热门标签

归档