gpt4 book ai didi

java - 在屏幕顶部显示按钮或图像

转载 作者:行者123 更新时间:2023-12-01 04:47:30 24 4
gpt4 key购买 nike

我正在开发一个 Android 项目,其中我需要在我的 Activity (屏幕)标题上显示一个 Button 或 ImageView。下面是我的 Activity 的 XML 布局。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/app"
android:layout_width="1dp"
android:layout_height="1dp"
android:layout_margin="2px"
android:orientation="vertical"
android:padding="2px" >


<LinearLayout
android:id="@+id/tabBar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >

<ImageView
android:id="@+id/BtnSlide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="0px"
android:padding="0px"
android:src="@drawable/button" />

</LinearLayout>

</LinearLayout>

通过上述布局,我可以在 Proximity 标题下方看到黑色按钮图像。是否可以将我的按钮图像显示在Proximity左侧,而不是显示在Proximity下方一行?

enter image description here

或者

有什么方法可以使位于 Proximity 标题的图像可点击吗?如果我能做到这一点,那么我就不需要在顶部显示黑色按钮图像。

该图像来自 AndroidManifest.xml 文件。我不知道如何使其可点击。

最佳答案

With the above layout, I can see my black button image just below the Proximity title. Is it possible to show my button image to left of Proximity instead of getting shown one line below Proximity?

由于 Proximity 位于标题栏中,您需要创建自己的自定义标题栏才能将按钮放置到标题栏。这是example如何实现。

还尝试思考 ActionBar 的用法.

关于java - 在屏幕顶部显示按钮或图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15592787/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com