安卓开发学习——day1

今天是学习安卓的第3天

由于以前没有接触过安卓,这几天的学习就像盲人过河,看一点写一点。对于安卓的了解不是很深入。
这几天主要用到的布局就是:LinearLayout GridLayout
控件主要使用到的是:TextView ImageButton EditView


遇到的问题也很多,比如按比例布局这些,经过百度查找:
将外层的线性表,添加:

android:orientation="vertical"

将线性布局设置为水平

内部,添加:

android:latyout_height="0dp"
android:layout_weight="X"

其实x就是所占比例

做出这些就能实现布局

在这里插入图片描述


还有将按钮边框设置圆角边框,经过查看老师的笔记,实现了圆角边框:
新建xml:

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <corners android:radius="10dp"/>
    <solid android:color="@color/white"/>
    <
    <stroke
        android:width="1dp"
        android:color="#555555"/>
</shape>

其中corner是设置圆角
solid设置内部填充颜色
staoke设置描边

然后在文件中调用:

android:background="@drawable/custom_border"

实现圆角边框
在这里插入图片描述


隐藏状态栏:
修改style.xml:

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

修改配置文件:Mainfest文件

android:theme="@style/AppTheme"

在这里插入图片描述
去掉状态栏时,发现按钮颜色也发生了改变,这应该时根据那三个颜色来实现取消状态连


同时还有很多问题没有解决,只有留在后面了

猜你喜欢

转载自blog.csdn.net/weixin_45936162/article/details/112341237