按钮点击跳转页面:(在java文件里写)

 1 public class MainActivity extends AppCompatActivity {
2
3 private Button mbtnTextView;
4
5 @Override
6 protected void onCreate(Bundle savedInstanceState) {
7 super.onCreate(savedInstanceState);
8 setContentView(R.layout.activity_main);
9
10 mbtnTextView = findViewById(R.id.btn_textview);
11 mbtnTextView.setOnClickListener(new View.OnClickListener() {
12 @Override
13 public void onClick(View view) {
14 //跳转到textview演示界面
15 Intent intent=new Intent(MainActivity.this,TextViewActivity.class);
16 startActivity(intent);
17 }
18 });
19 }
20 }

页面写不下的话用...表示

<TextView
android:id="@+id/tv_2"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="ahsdjahdjashdjsdjsjd"
android:ellipsize="end"
android:textColor="#000000"
android:textSize="25sp"
android:layout_marginTop="30dp"/>

插入图标等:

<TextView
android:id="@+id/tv_3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="筛选"
android:drawableRight="@drawable/jiantou"
android:drawablePadding="30dp"
android:textColor="#000000"
android:textSize="25sp" />

中划线和下划线除了页面之外要在Java文件里写:

 1 public class TextViewActivity extends AppCompatActivity {
2
3 private TextView vvv,mmm,ttt;
4 @Override
5 protected void onCreate(Bundle savedInstanceState) {
6 super.onCreate(savedInstanceState);
7 setContentView(R.layout.activity_text_view);
8 vvv=findViewById(R.id.tv_4);//这个命名随便命名,可以不是vvv
9 vvv.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);//中划线
10 vvv.getPaint().setAntiAlias(true);//消除锯齿
11
12 mmm=findViewById(R.id.tv_5);
13 mmm.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);//下划线
14
15 ttt=findViewById(R.id.tv_6);
16 ttt.setText(Html.fromHtml("<u>另一种下划线方式</u>"));//页内text内容可以不用写
17 }
18 }

跑马灯效果:

 1 <TextView
2 android:id="@+id/tv_7"
3 android:layout_width="wrap_content"
4 android:layout_height="wrap_content"
5 android:text="正在奔跑中啦啦啦啦正在奔跑中啦啦啦啦正在奔跑中啦啦啦啦"
6 android:textColor="#000000"
7 android:textSize="25sp"
8 android:singleLine="true"
9 android:ellipsize="marquee"
10 android:marqueeRepeatLimit="marquee_forever"//表示永远循环
11 android:focusable="true"//焦点
12 android:focusableInTouchMode="true"/>

这个跑马灯效果就是不断滚动的效果,如果不动的话可能是因为文字有点少 ,多复制点就好了,基本上应该是不需要在Java文件中写,只有中划线、下划线需要在Java文件中写代码。

最新文章

  1. JAVA笔试题集(一)--JAVASE部分
  2. IO 相关配置参数
  3. CentOS7.1配置源
  4. LEETCODE —— Maximum Subarray [一维DP]
  5. ecmobile-ios笔记
  6. 烂泥:通过binlog恢复mysql数据库
  7. Senparc.Weixin.MP.Sample 配置redis服务器密码
  8. CCLabelAtlas
  9. centos 下如何加入sudo 用户
  10. ZOJ 2588 Burning Bridges (tarjan求割边)
  11. POJ 1363 Rails(栈)
  12. ECSHOP商城全站自定义TITLE标题设置
  13. ZOJ 3826 Hierarchical Notation 模拟
  14. html学习笔记二
  15. 了解OData(一)
  16. [TPYBoard-Micropython之会python就能做硬件 3] 制作电子时钟
  17. JS打开摄像头并截图上传
  18. apache(OS 10013)以一种访问权限不允许的方式做了一个访问套接字的尝试 ...
  19. sublime text常用快捷键及多行光标批量操作教程
  20. Emacs flycheck插件配置中遇到的若干问题

热门文章

  1. elasticsearch算法之推荐系统的相似度算法(一)
  2. linux关闭swap
  3. 3D建模服务提供更高效、专业的3D制作能力,“筑”力开发者
  4. [ACM]Link-Cut Tree实现动态树初探
  5. resp.getWriter().print(categoryList)、resp.getWriter().write(String)与new ObjectMapper().writeValue(resp.getOutputStream(),categoryList)的区别
  6. 基于Autolayout的动画
  7. Mac版jdk1.6
  8. shell——eval exec
  9. swoole错误“Uncaught Error: Class &#39;swoole_server&#39; not found”的解决办法
  10. 高可用 &amp; 七层负载均衡与四层负载均衡