我一直在查看ProgressBar类的文档并找到这些属性:
我认为这四个参数应该是对某些风格的引用.所以问题是,这些是为了什么?进度条的样式通过android:style属性和对全局样式属性的引用设置.
文档没有说什么有用的,在网上搜索,一无所获.
我想删除自定义对话框上的黑色背景,如图所示.我确定黑色背景来自对话框,而不是应用程序的背景.
;
AlertDialog代码
public class MyAlertDialog extends AlertDialog {
public MyAlertDialog(Context context)
{
super(context);
}
public MyAlertDialog(Context context, int theme)
{ super(context, theme); }
}
Run Code Online (Sandbox Code Playgroud)
活动代码
public void showMyDialogOK(Context context, String s, DialogInterface.OnClickListener OkListener) {
MyAlertDialog myDialog = new MyAlertDialog(context, R.style.MyDialog2);
myDialog.setTitle(null);
myDialog.setMessage(s);
myDialog.setButton(DialogInterface.BUTTON_POSITIVE ,"Ok", OkListener);
myDialog.show();
}
Run Code Online (Sandbox Code Playgroud)
样式
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyTheme" parent="@android:style/Theme.NoTitleBar.Fullscreen">
<item name="android:alertDialogStyle">@style/AlertDialog</item>
</style>
<style name="MyTheme2" parent="@android:style/Theme.Black">
<item name="android:alertDialogStyle">@style/AlertDialog</item>
</style>
<style name="AlertDialog">
<item name="android:fullDark">@null</item>
<item name="android:fullBright">@null</item>
<item name="android:topDark">@drawable/popup_top_dark</item>
<item name="android:topBright">@null</item>
<item name="android:centerBright">@null</item>
<item name="android:centerDark">@drawable/popup_center_dark</item>
<item …Run Code Online (Sandbox Code Playgroud) 我遵循了这个示例代码
在Big Text Notifications部分中,他说需要扩展才能看到Big text notification形式,如下图所示:

我不知道我们做不到 set Expanded Notification as default in Big Text Notifications?
知道它的人是否可以,
如果能,
请告诉我怎么做,
谢谢,
我正在开发一个Activity我需要使导航栏不透明的地方,状态栏在运行5.0+(API 21+)的设备上是透明的.我正在使用的样式如下,以及我的问题的解释.
AppTheme 扩展 Theme.AppCompat.Light.NoActionBar
<item name="android:statusBarColor">@color/transparent</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@color/welbe_red_transparent</item>
Run Code Online (Sandbox Code Playgroud)
FullscreenTheme 扩展 AppTheme
<item name="android:windowNoTitle">true</item>
<item name="android:statusBarColor">@color/transparent</item>
<item name="android:windowTranslucentNavigation">true</item>
Run Code Online (Sandbox Code Playgroud)
这使得应用程序看起来像这样

如果我删除android:windowTranslucentNavigation样式,或将其设置false在Fullscreen,它修复了导航栏的问题.问题是状态栏变为完全白色而不是保持透明并显示其背后的内容.

我已尝试fitsSystemWindow="true"在我的布局中使用,但它没有解决问题.任何人都知道为什么会这样吗?
使用XML中的字体功能,您可以为字体系列指定各种字体粗细.例如:
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<font android:font="@font/archivo_narrow_regular" android:fontWeight="400" android:fontStyle="normal"
app:font="@font/archivo_narrow_regular" app:fontWeight="400" app:fontStyle="normal"/>
<font android:font="@font/archivo_narrow_regular_italic" android:fontWeight="400" android:fontStyle="italic"
app:font="@font/archivo_narrow_regular_italic" app:fontWeight="400" app:fontStyle="italic"/>
<font android:font="@font/archivo_narrow_medium" android:fontWeight="500" android:fontStyle="normal"
app:font="@font/archivo_narrow_medium" app:fontWeight="500" app:fontStyle="normal"/>
<font android:font="@font/archivo_narrow_medium_italic" android:fontWeight="500" android:fontStyle="italic"
app:font="@font/archivo_narrow_medium_italic" app:fontWeight="500" app:fontStyle="italic"/>
<font android:font="@font/archivo_narrow_semibold" android:fontWeight="600" android:fontStyle="normal"
app:font="@font/archivo_narrow_semibold" app:fontWeight="600" app:fontStyle="normal"/>
<font android:font="@font/archivo_narrow_semibold_italic" android:fontWeight="600" android:fontStyle="italic"
app:font="@font/archivo_narrow_semibold_italic" app:fontWeight="600" app:fontStyle="italic"/>
<font android:font="@font/archivo_narrow_bold" android:fontWeight="700" android:fontStyle="normal"
app:font="@font/archivo_narrow_bold" app:fontWeight="700" app:fontStyle="normal"/>
<font android:font="@font/archivo_narrow_bold_italic" android:fontWeight="700" android:fontStyle="italic"
app:font="@font/archivo_narrow_bold_italic" app:fontWeight="700" app:fontStyle="italic"/>
</font-family>
Run Code Online (Sandbox Code Playgroud)
但我无法弄清楚如何实际利用这些权重; 无论是在XML(布局/样式)文件中,还是在Java代码中.它们没有fontWeight可用的属性TextView,并且Typeface创建的对象ResourcesCompat.getFont(context, R.font.archivo_narrow)没有提到字体权重.
我意识到我只能指定特定的字体资源(即 …
我正在尝试使用材质样式自定义TextInputLayout.我设法将聚焦状态设置为我想要的颜色:
运用
<com.google.android.material.textfield.TextInputLayout
style="@style/LoginTextInputLayoutStyle"
android:theme="@style/LoginTextInputLayoutStyle"
android:textColorHint="#fff"
app:boxStrokeColor="#fff"
.....>
<EditText ...
Run Code Online (Sandbox Code Playgroud)
风格在哪里:
<style name="LoginTextInputLayoutStyle" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<item name="colorAccent">#fff</item>
</style>
Run Code Online (Sandbox Code Playgroud)
但是当textinput没有聚焦时,我得到了这样的表情:
如何将黑线的颜色也改为白色.谢谢
android android-styles material-design android-textinputlayout
android:windowBackground和之间有什么区别android:colorBackground?
例:
<style name = "theme">
<item name ="android:windowBackground">@color/black</item>
<item name ="android:colorBackground">@color/black</item>
</style>
Run Code Online (Sandbox Code Playgroud)
哪一个会影响您在加载新活动时看到的颜色?
我以编程方式创建像horizontalview那样,如何以编程方式传递AttributeSet.
我的构造函数看起来像这样:
public HorizontalListView(Context context, AttributeSet attrs) {
super(context, attrs);
}
Run Code Online (Sandbox Code Playgroud)
我试过这个:
mHlvSimpleList= new HorizontalListView(mcontext,R.style.niceview);
Run Code Online (Sandbox Code Playgroud)
错误:
构造函数HorizontalListView(Context,int)未定义
在style.xml中
<style name="niceview">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
</style>
Run Code Online (Sandbox Code Playgroud)
如何在horizontalistview构造函数匹配参数中传递AttributeSet?
我们如何使用android视图元素的百分比值?这样的事情
<TextView
android:id="@+id/"
android:layout_width="75%"
android:layout_height="50%"/>
Run Code Online (Sandbox Code Playgroud) 使用API21 + Toolbar:
// Toolbar
Toolbar toolbar = new Toolbar(this);
toolbar.showOverflowMenu();
Run Code Online (Sandbox Code Playgroud)
想彻底删除它的影子.setElevation(0)因为getElevation()已经返回,所以什么都不做0.
有材料设计参考:
https://material.io/guidelines/layout/structure.html#structure-toolbars
有开发参考:
https://developer.android.com/reference/android/widget/Toolbar.html
但我没有看到任何与阴影相关的信息. Toolbar
问题:如何完全删除/隐藏Toolbar阴影?