Android Studio项目开发过程中遇到的问题与解决方法(一)

1.如何去掉虚拟机上的AppName
	找到AndroidManifest.xml文件,修改android:theme为	
	android:theme="@style/Theme.Design.NoActionBar"

2.如何改变按钮的背景颜色
	在res/drawable下新建一个Drawable Resource File文件,并将Root element修改为
shape,在文件里面写按钮的颜色然后回到xml按钮处调用该文件即可。例:
	<?xml version="1.0" encoding="utf-8"?>
	<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <corners android:radius="9dp"/>
    <solid android:color="#c75fe768"/>
	</shape>
	如果这样还未成功的话,将app/res/values目录下的themes的style改成
<style name="Theme.AndroidLearning" 
parent="Theme.MaterialComponents.DayNight.NoActionBar.Bridge">
然后重启软件即可。

3.如何让APP可以访问网络
	找到AndroidManifest.xml文件,添加
	<uses-permission android:name="android.permission.INTERNET"/>即可。

4.如何生成getset方法
	点击右键,会看到Generate,点击此键会看到Getter and Setter,点击之后就能看到自己之
前设的变量,按住ctrl键可进行多选。

5.如何让APP可以进行访问网络
	在AndroidManifest.xml文件中添加
	<uses-permission android:name="android.permission.INTERNET"/>

6.Java如何进行多行注释
	选中需要注释的部分按住ctrl键和"/"键即可,反注释也是如此

猜你喜欢

转载自blog.csdn.net/SeNiLS/article/details/114391488