gpt4 book ai didi

android - 如何在Horizo​​ntalScrollView中将FrameLayout设置到最右侧

转载 作者:行者123 更新时间:2023-11-29 02:37:53 25 4
gpt4 key购买 nike

我想要 Horizo​​ntalScrollView 中最右侧的搜索按钮。
我尝试使用 android:layout_alignParentRight="true",
但它没有用我该怎么做?
非常感谢

View

我的XML代码:

<?xml version="1.0" encoding="utf-8"?>
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/folderPath_horizontalScrollView"
android:layout_width="match_parent"
android:layout_height="@dimen/actionbar_height"
android:fadeScrollbars="false"
android:fillViewport="true"
android:scrollbarThumbHorizontal="@drawable/folder_path_scrollbar_thumb"
android:splitMotionEvents="false">

<LinearLayout
android:id="@+id/folderPath_folder_path"
android:layout_width="wrap_content"
android:layout_height="@dimen/actionbar_height"
android:gravity="center_vertical"
android:orientation="horizontal"
android:background="@color/blue_B500"
android:splitMotionEvents="false" >

<FrameLayout
android:id="@+id/chat_search"
android:layout_width="@dimen/actionbar_height"
android:layout_height="@dimen/actionbar_height"
android:background="?actionBarItemBackground">

<View
android:layout_width="@dimen/_1dp"
android:layout_height="match_parent"
android:background="@drawable/divider_line" />

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:contentDescription="@string/Common_003"
app:srcCompat="@drawable/ic_search" />

</FrameLayout>
</LinearLayout>

最佳答案

你不能,因为 Horizo​​ntalScrollView 没有“最右边”。

Horizo​​ntalScrollView 有无限宽度,所以它不能有最右边。

将搜索 ImageView 移到 RelativeLayout 内的 Horizo​​ntalScrollView 之外,然后您可以执行 layout_alignParentRight

关于android - 如何在Horizo​​ntalScrollView中将FrameLayout设置到最右侧,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45979548/

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