xml 新建android
2016-12-07 10:54:18 notwalnut 阅读数 731

点击New–>Drawable resource file–>选择需要新建的xml类型,默认新建的是selector文件,只需将selector更换为shape,并在头标签中添加Android:shape=” “,引号中选择需要画的是Line,还是oval等,然后就可以设置不同属性了:自定义图形shape,Android上支持以下几种属性shape、gradient、stroke、corners、padding、solid等


<shape    
    xmlns:android="http://schemas.android.com/apk/res/android"    
    android:shape="rectangle">    
    <gradient android:startColor="#FFFF0000"  <!--设置圆角-->  
        android:endColor="#80FF00FF"    
        android:angle="270" />    
    <padding android:left="50dp"  <!--设置内容离边界的距离-->  
        android:top="20dp" android:right="7dp"    
        android:bottom="7dp" />    
    <solid android:color="#b4000000" /> <!--设置填充颜色-->   
    <stroke android:width="2.0dip"      <!--设置描边颜色-->   
        android:color="#b4ffffff"    
        android:dashWidth="3.0dip"    
        android:dashGap="0.0dip" />   
    <corners android:radius="8dp" />  <!--设置圆角-->  
</shape>   

shape是用来定义形状的,gradient定义该形状里面为渐变色填充,startColor起始颜色,endColor结束颜色,angle表示方向角度。当angle=0时,渐变色是从左向右。 然后逆时针方向转,当angle=90时为从下往上。

2015-12-09 11:51:35 fuzhongbin 阅读数 10174

点击New-->Drawable resource file-->选择需要新建的xml类型,默认新建的是selector文件,只需将selector更换为shape,并在头标签中添加android:shape=" ",引号中选择需要画的是Line,还是oval等,然后就可以设置不同属性了:自定义图形shape,Android上支持以下几种属性shape、gradient、stroke、corners、padding、solid等

<shape  
    xmlns:android="http://schemas.android.com/apk/res/android"  
    android:shape="rectangle">  
    <gradient android:startColor="#FFFF0000"  <!--设置圆角-->
        android:endColor="#80FF00FF"  
        android:angle="270" />  
    <padding android:left="50dp"  <!--设置内容离边界的距离-->
        android:top="20dp" android:right="7dp"  
        android:bottom="7dp" />  
    <solid android:color="#b4000000" /> <!--设置填充颜色--> 
    <stroke android:width="2.0dip"      <!--设置描边颜色--> 
        android:color="#b4ffffff"  
        android:dashWidth="3.0dip"  
        android:dashGap="0.0dip" /> 
    <corners android:radius="8dp" />  <!--设置圆角-->
</shape> 
shape是用来定义形状的,gradient定义该形状里面为渐变色填充,startColor起始颜色,endColor结束颜色,angle表示方向角度。当angle=0时,渐变色是从左向右。 然后逆时针方向转,当angle=90时为从下往上。

2018-09-28 15:56:45 l624547260 阅读数 694

xml文件报错是:Failed to load AppCompat ActionBar with unknown error.

有三种解决方式,都可以顺利解决

第一种:

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

将这个改成

<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">

在前面加上Base.,但我很困惑,因为

<style name="Theme.AppCompat.Light.DarkActionBar" parent="Base.Theme.AppCompat.Light.DarkActionBar"/>

第二种:

implementation 'com.android.support:appcompat-v7:28.0.0'

将28.0.0改成27.1.1

 implementation 'com.android.support:appcompat-v7:27.1.1'

然后将

compileSdkVersion 28
targetSdkVersion 28

改成

compileSdkVersion 27
targetSdkVersion 27

第三种

这个界面, 选择DeviceDefault的风格。

 

首先,以“Theme.”开头的都是应用于应用程序主题,在v7中有很多以“Base”开头的主题,是一些父主题,本身是不介意直接用的,

再看,AppCompat类的Theme是 兼容主题的根主题,而DeviceDefault类的Theme是设备默认根主题。

我们降低com.android.support:appcompat-v7的版本,问题将不复存在。

目测com.android.support:appcompat-v7 28.0.0应该对“Theme.”开头的做了限制,或者说对AppCompat类做了限制,好了,各位网友,谁告诉我,哪里可以看com.android.support:appcompat-v7 28.0.0到底更新了啥

2017-03-31 17:47:56 KH717586350 阅读数 427
java.lang.NullPointerException
at android.graphics.Bitmap_Delegate.createBitmap(Bitmap_Delegate.java:614)
at android.graphics.Bitmap_Delegate.createBitmap(Bitmap_Delegate.java:122)
at android.graphics.Bitmap_Delegate.createBitmap(Bitmap_Delegate.java:104)
at com.android.layoutlib.bridge.impl.ResourceHelper.getDrawable(ResourceHelper.java:249)
at com.android.layoutlib.bridge.impl.ResourceHelper.getDrawable(ResourceHelper.java:170)
at com.android.layoutlib.bridge.bars.CustomActionBarWrapper$WindowActionBarWrapper.getDrawable(CustomActionBarWrapper.java:374)
at com.android.layoutlib.bridge.bars.CustomActionBarWrapper$WindowActionBarWrapper.setupActionBar(CustomActionBarWrapper.java:285)
at com.android.layoutlib.bridge.bars.ActionBarLayout.<init>(ActionBarLayout.java:123)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.createActionBar(RenderSessionImpl.java:1628)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:356)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:332)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:350)
at org.eclipse.andmore.internal.editors.layout.gle2.RenderService.createRenderSession(RenderService.java:517)
at org.eclipse.andmore.internal.editors.layout.gle2.GraphicalEditorPart.renderWithBridge(GraphicalEditorPart.java:1585)
at org.eclipse.andmore.internal.editors.layout.gle2.GraphicalEditorPart.recomputeLayout(GraphicalEditorPart.java:1310)
at org.eclipse.andmore.internal.editors.layout.gle2.GraphicalEditorPart.activated(GraphicalEditorPart.java:1067)
at org.eclipse.andmore.internal.editors.layout.LayoutEditorDelegate.delegatePageChange(LayoutEditorDelegate.java:686)
at org.eclipse.andmore.internal.editors.common.CommonXmlEditor.pageChange(CommonXmlEditor.java:360)
at org.eclipse.ui.part.MultiPageEditorPart$2.widgetSelected(MultiPageEditorPart.java:295)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:249)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4418)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1103)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1088)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:802)
at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3167)
at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1850)
at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:333)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4418)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4236)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3824)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:693)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:610)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)

at org.eclipse.equinox.launcher.Main.run(Main.java:1519)


以上是错误日志

   解决方法:在AndroidManifest.xml中修改 android:icon="@drawable/ic_launcher" 将在src下新建drawable文件夹里面添加需要的APP图片,文件名替换ic_launcher(注意文件名不能为ic_lanucher必须改成别的)




2019-06-26 10:09:45 qq_38642745 阅读数 7

原文:https://blog.csdn.net/fuzhongbin/article/details/50234353

点击New–>Drawable resource file–>选择需要新建的xml类型,默认新建的是selector文件,只需将selector更换为shape,并在头标签中添加android:shape=" ",引号中选择需要画的是Line,还是oval等,然后就可以设置不同属性了:自定义图形shape,Android上支持以下几种属性shape、gradient、stroke、corners、padding、solid等

<shape  
    xmlns:android="http://schemas.android.com/apk/res/android"  
    android:shape="rectangle">  
    <gradient android:startColor="#FFFF0000"  <!--设置圆角-->
        android:endColor="#80FF00FF"  
        android:angle="270" />  
    <padding android:left="50dp"  <!--设置内容离边界的距离-->
        android:top="20dp" android:right="7dp"  
        android:bottom="7dp" />  
    <solid android:color="#b4000000" /> <!--设置填充颜色--> 
    <stroke android:width="2.0dip"      <!--设置描边颜色--> 
        android:color="#b4ffffff"  
        android:dashWidth="3.0dip"  
        android:dashGap="0.0dip" /> 
    <corners android:radius="8dp" />  <!--设置圆角-->
</shape> 

shape是用来定义形状的,gradient定义该形状里面为渐变色填充,startColor起始颜色,endColor结束颜色,angle表示方向角度。当angle=0时,渐变色是从左向右。 然后逆时针方向转,当angle=90时为从下往上。

Android 新建分区

阅读数 608

Android新建Activity

阅读数 3

Android新建Activity

阅读数 12

没有更多推荐了,返回首页