標籤:http 迴圈 format font tps ide creat 迴圈滾動 single
TextView標籤
<TextView android:text="我乃哈哈哈哈哈哈哈學習Androd" android:textSize="25dp" android:textColor="@android:color/holo_blue_dark" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" />
text:顯示文本資訊
textSize:設定文字大小
textColor:設定文本顏色
singleLine:單行顯示
ellipsize:設定省略符號顯示的位置,預設是end(結尾) start(開頭) middle(中間)
<TextView android:text="哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈啊哈哈啊哈哈哈哈哈哈" android:textSize="25dp" android:textColor="@android:color/holo_blue_dark" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:ellipsize="marquee" android:focusable="true" android:focusableInTouchMode="true" android:marqueeRepeatLimit="1" />
android:singleLine="true"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit 迴圈滾動次數(屬性值marquee_forever代表一直滾動)
android:marqueeRepeatLimit="5"
enabled:設定按鈕是否可以點擊
drawableTop:在按鈕文字上方加入圖片
drawableBottom
drawableLeft
drawableRight
drawableStart:國際化標準左
drawableEnd:國際化標準右
<TextView android:text="QQ郵箱: [email protected] 電話: 15116964938 網站: www.baidu.com" android:textSize="25dp" android:textColor="@android:color/holo_blue_dark" android:layout_width="wrap_content" android:layout_height="wrap_content" android:autoLink="all" /> <Button android:text="這隻是個按鈕" android:textColor="@android:color/holo_green_light" android:textSize="30dp" android:enabled="false" android:drawableTop="@mipmap/ic_launcher" android:drawableRight="@mipmap/ic_launcher" android:drawableLeft="@mipmap/ic_launcher" android:drawableBottom="@mipmap/ic_launcher" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <Button android:text="er" android:id="@+id/but01" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <Button android:text="san" android:id="@+id/but02" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:id="@+id/tvshow" android:layout_width="wrap_content" android:layout_height="wrap_content" />
代碼
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout_textview); View.OnClickListener click = new View.OnClickListener() { @Override public void onClick(View v) { int id = v.getId(); switch (id) { case R.id.but01: tvshow = (TextView) findViewById(R.id.tvshow); tvshow.setText("我來啦一號"); break; case R.id.but02: tvshow = (TextView) findViewById(R.id.tvshow); tvshow.setText("我來啦二號"); break; } } }; Button button = (Button) findViewById(R.id.but02); Button button2 = (Button) findViewById(R.id.but01); button.setOnClickListener(click); button2.setOnClickListener(click); // ATTENTION: This was auto-generated to implement the App Indexing API. // See https://g.co/AppIndexing/AndroidStudio for more information. client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build(); }
Android 基礎標籤