【2013.07.03】界面布局
1.TextView中文字的行间距设置
android:lineSpacingExtra="8dp"
2.给TextView中的文字添加CSS样式
text.setText(Html.fromHtml("<font style='line-height:50px'>你好</div>"));
3.通过include包含进某个布局的局部布局,其中的控件也就相当于在当前的布局中,可在Java代码中通过findViewById直接获取
<include layout="@layout/common_header" />
4.checkbox的效果
<?xml version="1.0" encoding="UTF-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="false" android:drawable="@drawable/cv_checked" /> <!-- checked --> <item android:state_checked="true" android:drawable="@drawable/cv_checked_not" /> <!-- default --> </selector>
5.Button,点击背景改变后复原的效果
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/button_checked" android:state_pressed="true"/> <item android:drawable="@drawable/button_green_checkno" android:state_focused="false" android:state_pressed="false"/> </selector>
6.ListView的监听
list.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) { Toast.makeText(getApplicationContext(), ""+position, Toast.LENGTH_SHORT).show(); } });
相关推荐
hqulyc 2020-02-21
fengyeezju 2020-02-02
fengyeezju 2020-02-02
安辉 2020-01-30
pengjin 2020-01-28
安辉 2020-01-25
fengyeezju 2020-01-11
csdnuuu 2020-01-04
相对布局只要是要有参照物,即谁在谁下方,谁在谁左边,和谁左对齐,等等。然后再添加一个按钮使其在textView的下方以及在立即更新按钮的左边。android:text="发现新的版本,您想现在更新吗?
magic00 2020-01-04
安辉 2013-07-14
冰川孤辰 2013-07-12
Tom天天 2013-07-12
WangWY 2013-07-03
Lzn0 2013-09-05
CrazyDavid 2013-09-03
tianhui 2013-08-23
Rgenxiao 2011-04-06
西木 2011-04-06