一直试图改变材质的浮动动作按钮颜色,但没有成功.
<android.support.design.widget.FloatingActionButton
android:id="@+id/profile_edit_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="16dp"
android:clickable="true"
android:src="@drawable/ic_mode_edit_white_24dp" />
Run Code Online (Sandbox Code Playgroud)
我试过补充一下
android:background="@color/mycolor"
Run Code Online (Sandbox Code Playgroud)
或通过代码
FloatingActionButton fab = (FloatingActionButton) rootView.findViewById(R.id.profile_edit_fab);
fab.setBackgroundColor(Color.parseColor("#mycolor"));
Run Code Online (Sandbox Code Playgroud)
要么
fab.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#mycolor")));
Run Code Online (Sandbox Code Playgroud)
但以上都没有奏效.我也在"重复的问题"中尝试了解决方案,但它们都没有工作,按钮保持绿色并且也变成了正方形.
我想详细解答一下,谢谢.
PS知道如何添加涟漪效果也不错,也无法理解.
试图移动我的东西Toolbar
而不是动作栏,但我不断收到错误说
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tyczj.weddingalbum/com.xxx.xxx.MainActivity}: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5039)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. …
Run Code Online (Sandbox Code Playgroud) android android-actionbar material-design android-5.0-lollipop android-toolbar
在我的应用程序"Tide Now WA"中,我最近使用新的Nexus 9平板电脑(Lollipop - API 21)测试了兼容性.
它会写一些按钮文字.此应用程序使用Android 2.3和Android 4.0正确编写文本.即混合资本和小写字母.
当我的Nexus 9上运行相同的应用程序时,文本中的所有字母都大写.
FWIW我的清单包含以下声明:
uses-sdk android:minSdkVersion="10" android:targetSdkVersion="14"
我可以在我的代码中修复此问题,还是操作系统中的错误感谢
尝试在我的项目中使用最新的appcompat-v7支持库时,出现以下错误:
/Users/greg/dev/mobile/android_project/app/build/intermediates/exploded-aar/com.android.support/appcompat-v7/21.0.0/res/values-v11/values.xml
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Run Code Online (Sandbox Code Playgroud)
我该如何解决?
android gradle xamarin.android android-support-library android-5.0-lollipop
我对材料设计的按钮样式感到困惑.我想得到彩色凸起的按钮,如附带的链接,就像在使用部分下看到的"强制停止"和"卸载"按钮一样.是否有可用的样式或我需要定义它们?
http://www.google.com/design/spec/components/buttons.html#buttons-usage
我找不到默认的按钮样式.
例:
<Button style="@style/PrimaryButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Calculate"
android:id="@+id/button3"
android:layout_below="@+id/editText5"
android:layout_alignEnd="@+id/editText5"
android:enabled="true" />
Run Code Online (Sandbox Code Playgroud)
如果我尝试通过添加更改按钮的背景颜色
android:background="@color/primary"
Run Code Online (Sandbox Code Playgroud)
所有的风格都消失了,比如触摸动画,阴影,圆角等.
我正进入(状态
开放失败:
EACCES (Permission denied)
在线上 OutputStream myOutput = new FileOutputStream(outFileName);
我检查了根,我试过了android.permission.WRITE_EXTERNAL_STORAGE
.
我该如何解决这个问题?
try {
InputStream myInput;
myInput = getAssets().open("XXX.db");
// Path to the just created empty db
String outFileName = "/data/data/XX/databases/"
+ "XXX.db";
// Open the empty db as the output stream
OutputStream myOutput = new FileOutputStream(outFileName);
// Transfer bytes from the inputfile to the outputfile
byte[] buffer = new byte[1024];
int length;
while ((length = myInput.read(buffer)) > 0) {
myOutput.write(buffer, 0, length);
}
// Close the …
Run Code Online (Sandbox Code Playgroud) android android-permissions android-5.0-lollipop android-storage
我使用的是Android v21支持库.
我创建了一个自定义背景颜色的按钮.当我使用背景颜色时,材质设计效果如波纹,显示消失(除了点击的高度).
<Button
style="?android:attr/buttonStyleSmall"
android:background="?attr/colorPrimary"
android:textColor="@color/white"
android:textAllCaps="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Button1"
/>
Run Code Online (Sandbox Code Playgroud)
以下是一个普通的按钮,效果很好.
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAllCaps="true"
android:text="Button1"
/>
Run Code Online (Sandbox Code Playgroud)
由于下载最新的SDK并安装Android Studio,我的项目无法构建.我收到以下消息:
Error:Gradle: Execution failed for task ':SampleProject:processProdDebugManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 14 cannot be smaller than version L declared in library com.android.support:support-v4:21.0.0-rc1
Run Code Online (Sandbox Code Playgroud) android android-studio android-gradle-plugin android-5.0-lollipop
我有一个显示自定义通知的应用.问题是,在Android 5中运行时,通知栏中的小图标显示为白色.我怎样才能解决这个问题?
纵观在为Android"L"预览API diff报告,我看到与在导航模式的所有方法ActionBar
类(如setNavigationMode()
,addTab()
,selectTab()
,&C).现已弃用.
文档说明:
不推荐使用操作栏导航模式,内联工具栏操作栏不支持.请考虑使用其他常见的导航模式.
什么是假设的替代品?
另外,"内联工具栏操作栏"是一个新概念吗?我不认为我以前听说过.
android android-actionbar android-navigation android-5.0-lollipop