我想与图像一起使用
<com.gc.materialdesign.views.ButtonFlat
android:id="@+id/buttonflat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#1E88E5"
android:text="Button" />
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
更新支持库后,我试图在导航抽屉上设置阴影,但由于某种原因,没有任何效果,我很困惑。
我遇到了这个问题,但它的解决方案是仅使用 setElevation ,这对我来说也不起作用:https://code.google.com/p/android/issues/detail ?id=184434
确实没有太多代码可发布,但以下是我所说的供参考:
int currentapiVersion = android.os.Build.VERSION.SDK_INT;
if (currentapiVersion >= android.os.Build.VERSION_CODES.LOLLIPOP) {
mDrawerLayout.setDrawerElevation(25f);
} else {
mDrawerLayout.setDrawerShadow(R.drawable.left_drawer_shadow, GravityCompat.START);
}
Run Code Online (Sandbox Code Playgroud)
我正在使用 ScrimInsetsFrameLayout 但这不应该导致问题 AFAIKT。
有任何想法吗?
我有cardview如下所示的布局,但文件中的两个元素彼此堆叠。我读过其他帖子,说要能够更有效地分隔元素,您必须在 内有另一个布局cardview,但它对我不起作用。如果我添加 aandroid:layout_above...那么其中一个元素就会消失。我想要一个元素高于另一个元素。谁能指出我做错了什么?
<android.support.v7.widget.CardView\n xmlns:card_view="http://schemas.android.com/apk/res-auto"\n android:id="@+id/currentData"\n android:layout_width="match_parent"\n android:layout_height="wrap_content"\n card_view:cardCornerRadius="4dp"\n card_view:cardBackgroundColor="@color/orange">\n\n <RelativeLayout\n android:id="@+id/cardviewLayout"\n android:layout_width="wrap_content"\n android:layout_height="wrap_content"\n android:layout_gravity="center"\n android:padding="10dp"\n android:orientation="vertical">\n\n <TextView\n android:id="@+id/time"\n tools:text="this is the time"\n android:layout_width="wrap_content"\n android:layout_height="wrap_content"\n android:layout_centerHorizontal="true"\n android:layout_centerVertical="true"\n android:layout_above="@+id/temperature"\n android:textColor="@color/white"/>\n\n <TextView\n android:id="@+id/temperature"\n tools:text="50\xc2\xb0"\n android:layout_width="wrap_content"\n android:layout_height="wrap_content"\n android:layout_centerHorizontal="true"\n android:layout_centerVertical="true"\n android:textSize="50sp" />\n\n </RelativeLayout>\n\n</android.support.v7.widget.CardView>\nRun Code Online (Sandbox Code Playgroud)\n ImageButton plusButton = new ImageButton(context);
plusButton.setImageResource(x);
Run Code Online (Sandbox Code Playgroud)
我需要一些资源来代替x上面的代码行,例如,实现下图中电话号码字段附近显示的减号和加号按钮之类的功能:
但我不知道这些图片的资源在哪里。所以请帮我解决这个问题。谢谢。
有没有办法改变导航抽屉图标的颜色?我的意思是,即使我使用包含多种颜色的 png,应用程序中绘制的图标也只有一种颜色,并且我认为默认颜色是灰色,我可以将其设为彩色吗?
例如:
这是我的 png 文件,我想将其用作图标,但是当我将它用作导航抽屉项目的图标时,它会像这样绘制:
嘿,我想弄清楚如何在我自己的应用程序中调用 SampleMessageDialog。
到目前为止,这是我表单上应该打开消息框的按钮的代码:
Private Async Sub BrowseButton_Copy_Click(sender As Object, e As RoutedEventArgs) Handles BrowseButton_Copy.Click
msgBoxPop.showPop()
End Sub
Run Code Online (Sandbox Code Playgroud)
这是showPop:
Imports MaterialDesignThemes.Wpf
Imports newRegisterProg.MaterialDesignColors.WpfExample.Domain
Public Class msgBoxPop
Public Shared Async Sub showPop()
Dim sampleMessageDialog = New SampleMessageDialog()
With sampleMessageDialog
.Message.Text = "TEST!"
End With
Await DialogHost.Show(sampleMessageDialog, "RootDialog")
End Sub
End Class
Run Code Online (Sandbox Code Playgroud)
最后这是用户控件:
<UserControl x:Class="MaterialDesignColors.WpfExample.Domain.SampleMessageDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
x:Name="messagePOP"
d:DesignHeight="300" d:DesignWidth="300"
MaxWidth="400">
<Grid Margin="16">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock x:Name="Message"
Margin="0 6 0 0"
FontSize="18" Grid.Row="0"/> …Run Code Online (Sandbox Code Playgroud) 我有几个使用mdTooltip属性指令的元素(这就是所谓的对吗?)
@Component({
selector: 'status-bar',
template: '<md-icon #iconOne mdTooltip="Connected">check_circle</md-icon>
<md-icon #iconTwo mdTooltip="Disconnected">warning<md-icon>'
})
Run Code Online (Sandbox Code Playgroud)
我可以使用toggle()以下方法调用该方法:iconOne
export class StatusBarComponent implements OnInit {
@ViewChild(MdTooltip) myIcon: MdTooltip;
ngOnInit(): void {
this.myIcon.toggle();
}
}
Run Code Online (Sandbox Code Playgroud)
按照我的理解,我应用属性指令的元素有点成为属性指令的类型。所以我尝试iconTwo这样选择:
@ViewChild('iconTwo') myIcon: MdTooltip;
Run Code Online (Sandbox Code Playgroud)
一旦执行代码,就会出现错误:
_this.myIcon.toggle 不是函数
我猜该项目没有正确选择。如何定位第二个图标并切换它?
我一直在努力检查是否点击了 mat-paginator的first last next或previous按钮,搜索了一堆网站,但找不到任何合理的方法。
如何检查单击了哪一个按钮?
这是我的分页信息的样子:
我有以下范围滑块,它显示从 1000 到 1,000,000 的值。
我想显示标签是一种更具可读性的格式,例如100k 1M 1k等。是否可以在工具提示内设置标签格式,以便对用户更有意义,并且不会破坏 UX。
我想用这个函数来改变数字的显示方式。
function numFormatter(num) {
if(num > 999 && num < 1000000){
return (num/1000).toFixed(0) + 'K'; // convert to K for number from > 1000 < 1 million
}else if(num > 1000000){
return (num/1000000).toFixed(0) + 'M'; // convert to M for number from > 1 million
}else if(num < 900){
return num; // if value < 1000, nothing to do
}
}
Run Code Online (Sandbox Code Playgroud) 尝试导航到使用 Material Motion 的 Fragment 时,我收到以下错误。
使用的版本:
java.lang.NoSuchFieldError: No field $stable of type I in class Landroidx/compose/animation/core/Transition; or its superclasses (declaration of 'androidx.compose.animation.core.Transition' appears in /data/app/~~NMhx8f3SifgkfcXt9VHSKg==/app.tempory.debug-ZA5ilk8Gd0enqUNaUHOpCg==/base.apk)
at com.google.accompanist.imageloading.MaterialLoadingImage.updateFadeInTransition(MaterialLoadingImage.kt:53)
at com.google.accompanist.imageloading.LoadPainterKt.animateFadeInColorFilter(LoadPainter.kt:382)
at com.google.accompanist.imageloading.LoadPainterKt.access$animateFadeInColorFilter(LoadPainter.kt:1)
at com.google.accompanist.imageloading.LoadPainterKt$animateFadeInColorFilter$3.invoke(Unknown Source:10)
at com.google.accompanist.imageloading.LoadPainterKt$animateFadeInColorFilter$3.invoke(Unknown Source:10)
at androidx.compose.runtime.RecomposeScopeImpl.compose(RecomposeScopeImpl.kt:140)
at androidx.compose.runtime.ComposerImpl.recomposeToGroupEnd(Composer.kt:2156)
at androidx.compose.runtime.ComposerImpl.skipCurrentGroup(Composer.kt:2399)
at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:2578)
at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:2571)
at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(SnapshotState.kt:523)
at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:2564)
at androidx.compose.runtime.ComposerImpl.recompose$runtime_release(Composer.kt:2540)
at androidx.compose.runtime.CompositionImpl.recompose(Composition.kt:613)
at androidx.compose.runtime.Recomposer.performRecompose(Recomposer.kt:764)
at androidx.compose.runtime.Recomposer.access$performRecompose(Recomposer.kt:103)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:447)
at androidx.compose.runtime.Recomposer$runRecomposeAndApplyChanges$2$2.invoke(Recomposer.kt:416)
at androidx.compose.ui.platform.AndroidUiFrameClock$withFrameNanos$2$callback$1.doFrame(AndroidUiFrameClock.android.kt:34) …Run Code Online (Sandbox Code Playgroud) android android-fragments material-design android-jetpack-compose
material-design ×10
android ×5
angular ×2
material-ui ×2
button ×1
reactjs ×1
slider ×1
vb.net ×1
wpf ×1