小编jac*_*ace的帖子

主题中colorPrimary和colorPrimaryDark有什么区别

我试图了解主题如何在android中运行.我不知道为什么colorPrimaryDark不能和我合作,或者我做错了.

我尝试了这个设置,我的操作栏由于colorPrimary而变为红色:

<style name="MenuTheme" parent="Theme.AppCompat.Light.DarkActionBar">
  <item name="colorPrimary">#FF0000</item>
  <item name="colorPrimaryDark">#0000FF</item>
  <item name="colorAccent">#00FF00</item>    
  <item name="actionMenuTextColor">#0000FF</item>
</style>
Run Code Online (Sandbox Code Playgroud)

我试图删除colorPrimary并且它变成黑色(我认为它会使用蓝色,因为colorPrimaryDark:

<style name="MenuTheme" parent="Theme.AppCompat.Light.DarkActionBar">
  <item name="colorPrimaryDark">#0000FF</item>
  <item name="colorAccent">#00FF00</item>    
  <item name="actionMenuTextColor">#0000FF</item>
</style>
Run Code Online (Sandbox Code Playgroud)

我试图删除colorPrimaryDark并离开colorPrimary并再次变为红色:

<style name="MenuTheme" parent="Theme.AppCompat.Light.DarkActionBar">
  <item name="colorPrimary">#FF0000</item>
  <item name="actionMenuTextColor">#0000FF</item>
</style>
Run Code Online (Sandbox Code Playgroud)

我不知道我是以错误的方式使用它还是根本没有改变.谁能告诉我他们之间的区别?

我还尝试了actionMenuTextColor来改变actionBar中的文本颜色,但什么都没发生.我发现解决方案使用parent ="Theme.AppCompat.Light.DarkActionBar"而不是parent ="Theme.AppCompat.Light".但当然它只会变成白色.如果有任何办法,我仍然试图用不同的颜色制作它.

xml android xamarin

20
推荐指数
2
解决办法
2万
查看次数

在Visual Studio中进行xamarin更新后,Android 5.1.1棒棒糖的应用程序启动时应用程序启动崩溃

我们之前开发了一个应用程序,用于软糖到牛轧糖,但现在我们在视觉工作室更新我们的xamarin后出现了问题.

以前,我们的apk完全在所有Android版本中运行,但现在更新后,它现在崩溃...但仅在5.1.1.我们已经用kitkat,棒棒糖5.1,棉花糖和牛轧糖进行了测试,它确实在运行.

我们注意到我们的应用程序在OnCreate方法中的最后一个大括号"}"之后崩溃了.它在没有事先细节的情况下发布了一个例外.

这个例外的原因是什么?或任何解决方案,如果有人已经解决它.

我不知道它是否只是由于xamarin更新而改变的设置.

例外情况仅发生在OPPO手机上,在其他5.1和5.1.1版本上进行了测试

Exception image is here and as I said, there is no single detail

enter image description here

Here is the debugger output

Android application is debugging.  
Mono Warning: option gen-compact-seq-points is deprecated.  
07-14 10:37:16.613 W/monodroid(18119): Trying to load sgen from: /data/app/RBOS_2.x_0.x_1.RBOS_2.x_0.x_1-1/lib/arm/libmonosgen-2.0.so
07-14 10:37:16.613 W/monodroid-debug(18119): Trying to initialize the debugger with options: --debugger-agent=transport=dt_socket,loglevel=0,address=127.0.0.1:29342,server=y,embedding=1  
07-14 10:37:16.953 W/monodroid-debug(18119): Accepted stdout connection: 29  
07-14 10:37:18.793 W/monodroid-gc(18119): GREF GC Threshold: 46080  
07-14 10:37:18.793 W/monodroid(18119): Calling into managed runtime init  
Loaded assembly: RBOS 2.0.1.dll …
Run Code Online (Sandbox Code Playgroud)

c# android xamarin.android xamarin android-5.1.1-lollipop

7
推荐指数
1
解决办法
753
查看次数

具有ViewPager组合的ExpandableListView作为其子项

更新 - 添加实验结果

是否可以实现ExpandableListView以拥有viewpager子项?

我试图将viewpager作为子项放在ExpandableListView中,但它没有显示:(我也尝试在ScrollView下添加它但结果相同所以我认为这是一个可滚动视图下的问题?但是当我删除ScrollView时它出现了.我能做什么才能一起去?


这就是我的目标

原始图片

当我尝试在我自己的代码上实现时会发生这种情况.
PS这只是一个采样器,还没有完成.我有3个孩子,我的布局也显示三次,每个项目都在里面

在此输入图像描述

android expandablelistview xamarin.android android-viewpager xamarin

7
推荐指数
1
解决办法
405
查看次数

Android.Views.InflateException:二进制XML文件行#1:错误膨胀类工具栏

我遇到了这个代码的问题.当我在kitkat中运行它时,它会提示未处理的异常

Android.Views.InflateException:二进制XML文件行#1:错误膨胀类工具栏

顺便说一句:我也用过

<android.support.v7.widget.Toolbar>

...

</ android.support.v7.widget.Toolbar>

正如其他问题所建议的那样,但它仍然是一样的.

<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    <!--Error came from this toolbar-->

    <Toolbar 
        android:minHeight="30dp"
        android:layout_width="match_parent"
        android:layout_height="30dp"
        android:background="@color/lime"
        android:id="@+id/toolbar"
        android:elevation="6dp">
        <TextView
            android:text="BranchName"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="left"
            android:layout_marginRight="155dp"
            android:id="@+id/branchName"
            android:textColor="#000000" />
        <TextView
            android:text="Logout"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="right"
            android:id="@+id/logout"
            android:layout_marginRight="5dp"
            android:elevation="8dp"
            android:textColor="#000000" />
    </Toolbar>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

它包含在其他.axml中

<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:minWidth="25px"
        android:minHeight="25px"
        android:background="#fafafa"
        android:weightSum="100">

        <!--Toolbar was called from here by include-->

        <include 
            layout="@layout/ToolbarLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <LinearLayout
            android:orientation="horizontal"
            android:minWidth="25px"
            android:minHeight="25px" …
Run Code Online (Sandbox Code Playgroud)

xml android xamarin.android

5
推荐指数
1
解决办法
1万
查看次数

REALM - System.TypeInitializationException:'Realms.Realm'的类型初始值设定项引发了异常.---> System.DllNotFoundException

这是领域的例外

{System.TypeInitializationException: The type initializer for 'Realms.Realm' threw an exception. ---> 
System.DllNotFoundException: realm-wrappers
  at (wrapper managed-to-native) Realms.NativeCommon:register_notify_realm_changed 
(Realms.NativeCommon/NotifyRealmCallback)
  at Realms.Realm..cctor () [0x0004f] in <f0097c463d884e09ba2bde58b530c6d7>:0 

--- End of inner exception stack trace ---
  at DAL.t_MobileUser..ctor () [0x0001e] in 
D:\visual studio 2015\Projects\RBankCI\DAL\t_MobileUser.cs:17 
  at BLL.BLL_MobileUser.m05_selectSpecific (System.Int32 id) [0x00013] in 
D:\visual studio 2015\Projects\RBankCI\BLL\BLL_MobileUser.cs:34 
  at RBankCI.Activity_PDRN.m7_btnSaveClick () [0x00008] in 
D:\visual studio 2015\Projects\RBankCI\RBankCI\Activities\Activity_PDRN.cs:96 }
Run Code Online (Sandbox Code Playgroud)

当我调用Realm realm = Realm.GetInstance(config); 我收到的错误位于顶部.我从nugget packager下载了这个领域,所以我不知道它说的是DllNotFoundException

我尝试下载这些版本,但异常的结果相同:2.1.0,0.82.1和0.80(与我以前的应用程序相同,没有例外)

这是我的示例代码.

    private Realm realm;

    public void insert(object obj)
    {
        try
        {
            realm = Realm.GetInstance(DAL_DBAccessVariable.config); //Error …
Run Code Online (Sandbox Code Playgroud)

android realm xamarin.android

5
推荐指数
1
解决办法
1027
查看次数

设置背景时按钮变大 - 如何使其变小

我想让我的按钮在设置背景之前缩小或恢复正常。

我知道使用背景色调可以使用相同的背景颜色来解决此问题,但我的问题是我在背景上使用选择器。当选择器设置为按钮背景时,它变得更宽。当我将背景切换为背景色调时,颜色变得不同(例如对我来说是紫色)并且按下时不会改变颜色。填充不能通过设置负值或正值来解决。我还可以做些什么 ?我的目标是我的按钮在单击时会改变颜色,但它的高度很窄/默认大小,就像换行内容一样。

这是我的按钮示例代码

<Button
    android:text="Add"
    android:fontFamily="@string/fontFamily"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:id="@+id/btnInformantsAdd"
    android:gravity="center"
    android:textColor="@color/white"
    android:textSize="@dimen/textSizeCommon"
    android:background="@drawable/ButtonSelectorBlue"
    android:paddingTop="-10dp"
    android:paddingBottom="-10dp"
    android:layout_gravity="center"
    android:layout_marginTop="@dimen/marginTop1"
    android:layout_marginBottom="@dimen/marginTop1" />
Run Code Online (Sandbox Code Playgroud)

选择器 XML 代码

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:state_pressed="true">
    <layer-list>
      <item>
        <shape android:shape="rectangle">
          <solid android:color="@color/bluegreendark_light" />
          <padding android:left="10dp"
             android:top="@dimen/paddingSide1"
             android:right="10dp"
             android:bottom="@dimen/paddingSide1"/>
          <corners android:radius="5dp" />
        </shape>
      </item>
    </layer-list>
  </item>

  <item android:state_pressed="false">
    <layer-list>
      <item>
        <shape android:shape="rectangle">
          <solid android:color="@color/bluegreendark"/>
          <padding android:left="0dp"
             android:top="0dp"
             android:right="0dp"
             android:bottom="0dp"/>
          <corners android:radius="5dp" />
        </shape>
      </item>
    </layer-list>
  </item>
</selector>
Run Code Online (Sandbox Code Playgroud)

android button xamarin.android xamarin

5
推荐指数
1
解决办法
1487
查看次数

该软件包需要NuGet客户端版本“ 3.6.0”或更高版本

我想安装Microsoft.EntityFrameworkCore及其组件。我正在将Visual Studio 2015与NuGet Client版本先前为3.5.0一起使用,现在我已按照错误报告的指示从https://www.nuget.org/downloads下载了3.6.0-rtm-2511(这是最新的)。我不知道为什么仍然需要3.6.0或更高版本的问题仍然存在。

如何以其他方式更新我的NuGet软件包管理器?
我无法从“工具”>“扩展和更新”>“更新”>“ Visual Studio库”中的“更新”中找到Visual Studio的Nuget软件包管理器。
我只能在“工具”>“扩展和更新”>“已安装”中看到它,但是没有更新,但是我注意到选中了“自动更新此扩展”。

PM控制台的结果

PM> install-package microsoft.entityframeworkcore.sqlserver  
  GET https://api.nuget.org/v3/registration3-gz-semver2/microsoft.entityframeworkcore.sqlserver/index.json  
  OK https://api.nuget.org/v3/registration3-gz-semver2/microsoft.entityframeworkcore.sqlserver/index.json 329ms  
Retrieving package 'Microsoft.EntityFrameworkCore.SqlServer 2.1.1' from 'nuget.org'.  
Install failed. Rolling back...  
Uninstalling NuGet package Microsoft.EntityFrameworkCore.SqlServer.2.1.1.  
Executing nuget actions took 162.34 ms  
install-package : The 'Microsoft.EntityFrameworkCore.SqlServer 2.1.1' package requires NuGet client version '3.6.0' or above, but the current NuGet 
version is '3.6.0-rtm-2511'. To upgrade NuGet, please go to http://docs.nuget.org/consume/installing-nuget  
At line:1 char:1  
+ install-package microsoft.entityframeworkcore.sqlserver  
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
    + CategoryInfo          : NotSpecified: …
Run Code Online (Sandbox Code Playgroud)

c# visual-studio nuget

4
推荐指数
1
解决办法
3468
查看次数