布局定义用户界面的可视结构,例如活动,片段或应用程序窗口小部件的UI。
android中如何根据软键盘调整fragment中的屏幕大小?
当我尝试根据软键盘调整片段的屏幕大小时,我面临的问题是,屏幕没有在片段中调整,而是在活动中调整。我尝试了很多解决方案...
根据登录用户更改 Xamarin.Android 布局中的主题
我有一个 Xamarin Android 应用程序,它通过 json 文件获取主题设置。应用程序字体、颜色等应基于 json 文件中的值。我不确定最好的方法
如何更改可绘制ImageView的颜色android kotlin
我的可绘制包ic_vector_point_image中有一个矢量图标: 我的 vector 包中有一个 drawable 图标 ic_vector_point_image: <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="10dp" android:height="10dp" android:viewportWidth="3" android:viewportHeight="3"> <path android:pathData="M1.5,1.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0" android:fillColor="#4C55E4"/> --- blue color </vector> 然后我将这个 vector 图标与我的 ImageView: <ImageView android:id="@+id/point" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="3.7dp" android:src="@drawable/ic_vector_typing_indicator_point" app:layout_constraintBottom_toBottomOf="@id/typing_text" app:layout_constraintStart_toStartOf="parent" tools:ignore="ContentDescription" /> 我需要为此 argb 设置 drawable 颜色,如下所示: imageView.setColor(Color.argb())。我该怎么做? 您可以像这样更改图像视图的色调: imageView.setColorFilter(Color.argb(255, 255, 255, 255)); // 白色
<androidx.constraintlayout.widget.ConstraintLayout android:layout_width="0dp" android:layout_height="52dp" android:layout_marginHorizontal="20dp" android:background="@android:color/white" android:clipToPadding="false" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent"> <ImageView android:layout_width="32dp" android:layout_height="32dp" android:layout_marginTop="-12dp" android:layout_marginEnd="-12dp" android:alpha=".50" app:srcCompat="@drawable/ic_close_two" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent"/> </androidx.constraintlayout.widget.ConstraintLayout> ImageView的溢出不显示但边框后被切断,如何修复?
我需要将每行中的元素居中,这样它们就像在这个模型中一样。 我一直在寻找是否有任何布局可以在不看的情况下以这种方式工作。 项目在其行中居中。 这是嗬...
为什么夜间主题中ActionBar的真实背景颜色与xml中的不同?
为什么夜间主题中ActionBar的真实背景颜色与xml中的不同?白天一切都很好。 附注实际上是一天 大概是一天 实际上是晚上 大概是晚上 普...
`错误不断显示“需要恒定的表达式”,阻止我在设备上运行应用程序以进一步开发应用程序。 我正在尝试创建一种谷歌支付..所以我需要
设置LinearLayout位于fragment上方,TableLayout位于fragment下方
我认为解决方案非常简单,但我无法弄清楚。 该页面基本上分为 3 个部分。顶部是一个线性布局,可以和里面的内容一样高。底部有一张桌子...
我必须调整 HDPI 设备的布局尺寸。因此,我在 value-hdpi 文件夹中添加了尺寸。 Values-hdpi 文件夹中的尺寸减小 我必须调整 HDPI 设备的布局尺寸。因此,我在 values-hdpi 文件夹中添加了尺寸。 values-hdpi文件夹中的尺寸减量 <resources> <dimen name="tracking_activity_marging_top">8dp</dimen> </resources> values文件夹中的尺寸减速 <resources> <dimen name="tracking_activity_marging_top">14dp</dimen> </resources> 在 HDPI 设备中正确选择了 Values-hdpi 文件夹中定义的尺寸值。但是,XXHDPI 设备(以及具有非 hdpi 分辨率的设备)从 values-hdpi 文件夹而不是普通 values 文件夹中选择值。 为什么非 hdpi 设备从 hdpi 文件夹中选取值?我该如何解决? 问题发生在库模块中。应用程序模块中的尺寸选择正确。 每个模块都有自己的资源文件夹,您可能还想根据库模块的屏幕 dpi 添加尺寸限定符。
在 Android 中将按钮和带有省略号的 TextView 居中
我有以下带有 TextView 和 Button 的代码,我希望它们居中。当文本太长时会出现问题,因此即使我使用省略号也会将按钮推离屏幕。 我没有
安卓应用运行 Android Studio XML 布局 我对 Android 应用程序运行图像上的 XML 布局有疑问,图标看起来不太正确。它有双按钮和放置器......
android.view.InflateException:二进制 XML 文件第 21 行:无法解析索引 1 处的属性:TypedValue{t=0x2/d=0x7f040007 a=-1}
我正在尝试在 Android 9 平板电脑上运行我的 Android Java 应用程序(我也尝试过 Android 13 手机),但它告诉我它无法解析索引 1 处的属性:TypedValue{t=0x2/ d=0x7f040007 a=-...
我在使用搜索栏的页面上工作,我设计了一个自定义拇指和可在搜索栏中绘制的进度条,但进度条高度没有按照我的意愿出现,尽管它的高度相同......
A similar question has been asked here,但不是针对 Android 开发,也没有得到充分的回答。 在我的应用程序中,我想将文本对齐到右下角。 到目前为止,一切都很好。 然而...
如何在 LinearLayout 中将元素放置在 WebView 下方?
我尝试创建一个带有 WebView 的片段,该片段的上方和下方都有一个 Button。显示了上面的按钮,但没有显示下面的按钮。就像 WebView 试图占据所有...
我编写了以下应用程序,其中显示了 3 x 4 的按钮网格,用户可以通过单击菜单项来更改网格尺寸。问题是“
Android:相对布局内的两个以编程方式创建的子元素未正确对齐在水平线上
我想在相对布局中并排创建两个元素。这是我的代码: int pixels = (int) (20 * scale + 0.5f); ImageView img = new ImageView(candidate_registration_1.this); 文本视图...
Android:如何将视图设置为在将其定位在两个固定视图之间时滚动?
我有一个固定的工具栏,一个带有 layout_scrollFlags="scroll" 的视图,一个用于过滤的固定视图和一个回收器视图,在 CoordinatorLayout 中按照从上到下的顺序排列。 这个我...
我想将两个 TextView 并排放置,让它们根据内容展开。 两个 TextView 的内容都是完全动态且不可预测的,因此我想要
我在我的 Activity 中制作了一个简单的 AlertDialog: 查看 view = layoutInflater.inflate(R.layout.my_dialog, null); AlertDialog infoDialog = new AlertDialog.Builder(MyActivity.this) .设置...