Android自查笔记

1.线性布局:
水平垂直
android:orirntation = "vertical"垂直,另一个是水平

2.按钮放在右边:
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/bu_deng"
android:text="登录"
android:layout_alignParentRight="true" //按键靠右放置
/>

3.控件上下的距离是 marginTop = “20dp”

4.取出我们的用户名和密码
String

判断字符串变量str,是不是空的字符串
空字符串检测的方法
if("".equals(name))
{

}
油条方法
if(TextUtils.isEmpty(name))
{

}

5.密码密文操作,密码是不是显示星星
android:password="true"


6.实例化一个TextView
TextView tv1 = (TextView)findViewById(R.id.tv_denglu);

7。图标的文件夹
D:\Example_android\layouttt\app\src\main\res\mipmap-xxhdpi


8.吐司显示
Toast.makeText(MainActivity.this,"你这个密码或者账号是空的", Toast.LENGTH_SHORT).show();

9.界面转换

Intent my1 = new Intent(sman.this, s208.class);

startActivity(my1);


10.线性布局的垂直布局

android:orientation="vertical"

水平布局
android:orientation="horizontal"



11.匿名内部类,写在Oncreate里面
Button bb_210 = (Button) findViewById(R.id.b210);
bb_210.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent mmy = new Intent(sman.this,s210.class);
startActivity(mmy);
}
});

12、在xml文件中引用图片文件
eclipse:android:background="@drawable/sliding"
as:android:background="@mipmap/sliding"


13.
android:layout_marginStart:如果在LTR布局模式下,该属性等同于android:layout_marginLeft。如果在RTL布局模式下,该属性等同于android:layout_marginRight。








猜你喜欢

转载自www.cnblogs.com/gzyx/p/11439358.html