AS笔记

来源:互联网 发布:淘宝彩票是真的吗 编辑:程序博客网 时间:2024/05/21 01:31

10.底部4个图标自适应布局均分
这里写图片描述
< button
android:layout_width=”0dp”
android:layout_height=”match_parent”
/>
11.设置管理界面头像
这里写图片描述
< ImageView
android:id=”@+id/btn_head”
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:src=”@drawable/btn_head”
android:scaleType=”fitStart”
android:paddingLeft=”20dp”
/>
12. MainActivity文件中加入getSupportActionBar().hide();
可以将上标题栏隐藏

13. 划出大范围,然后让各分块自适应vertical排列
这里写图片描述
< LinearLayout
android:layout_width=”match_parent”
android:layout_height=”match_parent”
android:layout_weight=”0.4”
android:orientation=”vertical” >
< Button>
style=”@style/heiha”
android:text=”第1行” >

< Button
style=”@style/heiha”
android:text=”第2行”>

<Button    android:id="@+id/button2"    style="@style/heiha"    android:text="第3行" ></Button><Button    android:id="@+id/button3"    style="@style/heiha"    android:text="第4行"></Button>


接下
14.Style模版app-res-values-style.xml
< style name=”heiha”>
< item name=”android:layout_height”>wrap_content< /item>
< item name=”android:layout_width”>match_parent< /item>
< item name=”android:gravity”>left|center< /item>
< item name=”android:textSize”>24dp< /item>
< /style>
用的时候直接引用就行—-避免重复冗余
< Button
android:id=”@+id/button3”
style=”@style/heiha”
android:text=”第4行”>
< /Button>

16 这里写图片描述
方法一:一个ImageView用于显示图片 + 一个TextView用于显示文字,然后把他们丢到一个LinearLayout中,接着依次创建四个这样的小布局,再另外放到一个大的LinearLayout
方法二:drawableleft
drawableright
drawabletop
drawablebottom

17 background会根据ImageView组件给定的长宽进行拉伸,而src就存放的是原图的大小,不会进行拉伸

18scaleType只对src起作用—-控制图片的缩放方式
这里写图片描述
< ImageView xmlns:android=”http://schemas.android.com/apk/res/android”
android:id=”@+id/splash_image”
android:layout_width=”match_parent”
android:layout_height=”match_parent”
android:src=”@drawable/splash_bg”
android:background=”@color/black”
android:scaleType=”centerInside”/>

19.ImageView对应src,不要用background,写成了blackground的话可是会报空指针的哦!!!!

20.wrap_content:表示大小刚好足够显示当前控件里的内容
match_parent:强制性让它布满整个屏幕
这里写图片描述
< Button
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:text=”Aj1”
/>
< Button
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:text=”AJ2”
/>
< Button
android:layout_width=”match_parent”
android:layout_height=”match_parent”
android:text=”AJ3”
/>

原创粉丝点击