UI效果(3)

来源:互联网 发布:mysql declare 赋值 编辑:程序博客网 时间:2024/06/02 01:46

> Textview

1.textview动态设置 DrableLeft 以及改变图片大小

if (i_count==0){
            Drawable drawable1= getResources().getDrawable(R.drawable.ic_news_comment_write);
/// 这一步必须要做,否则不会显示.
            drawable1.setBounds(0, 0, 30, 30);
            tvComment.setCompoundDrawables(drawable1,null,null,null);
//            tvComment.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_news_comment_write,0,0,0);
            tvComment.setText("写评论");
        }else {
            Drawable drawable2= getResources().getDrawable(R.drawable.ic_comment_top);
/// 这一步必须要做,否则不会显示.
            drawable2.setBounds(0, 0, drawable2.getMinimumWidth(), drawable2.getMinimumHeight());
            tvComment.setCompoundDrawables(drawable2,null,null,null);
            tvComment.setText(" "+count + " 评论");
        }
        tvComment.setVisibility(isLoaded ? View.VISIBLE : View.GONE);
    }
控制图片大小    

drawable1.setBounds(0, 0, 30, 30);   控制图片大小   第一0是距左边距离,第二0是距上边距离,30分别是长宽

2.Android TextView 添加下划线的几种方式- http://www.cnblogs.com/popfisher/p/5191242.html
android:autoLink="all"

3.Android TextView 添加下划线的几种方式- http://www.cnblogs.com/popfisher/p/5191242.html
tvTest.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG); //下划线
tvTest.getPaint().setAntiAlias(true);//抗锯齿

Android Y轴TextView旋转动画Animation- http://blog.csdn.net/true_maitian/article/details/54969600
让TextView里面的文字逐个显示的动画效果实现(1)- http://www.cnblogs.com/laishenghao/p/5134811.html
imageCaptionTv.setText("Text Here");
imageCaption.post(new Runnable() {
    @Override
    public void run() {
        int lineCount    = imageCaptionTv.getLineCount();
    }
});

> EditText 
4. 这里想设置的就是之前的手机icon和”请输入手机号“之间的距离,则可是使用以下的方式:android:drawablePadding="8dp"
         <EditText 
    android:id="@+id/tel_num"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="25dp"
            android:layout_marginLeft="10dp"
    android:layout_marginRight="10dp"
             android:drawablePadding="8dp"
    android:drawableLeft="@drawable/phone"
    android:hint="请输入手机号码"
         />
5.Android之自定义EditText光标和下划线颜色- http://blog.csdn.net/w690333243/article/details/73559120
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <size android:width="2dp" />
    <solid android:color="@android:color/holo_blue_light" />
</shape>

<EditText android:textCursorDrawable="@drawable/cursor_color"/>

android:textColorHint="#03A9F4"


> LinearLayout

6. LinearLayout居右: android:layout_gravity="right|center_vertical"  


> ScrollView

7.Android 控制ScrollView滚动到底部- http://blog.csdn.net/t12x3456/article/details/12799825
scrollView.fullScroll(ScrollView.FOCUS_DOWN);滚动到底部
scrollView.fullScroll(ScrollView.FOCUS_UP);滚动到顶部

总结ScrollView嵌套ListView的解决方法- http://blog.csdn.net/android_technology/article/details/52281795


> ProgressBar

android的ProgressBar的setIndeterminate(false);这个是干嘛的?
    不明确(false)就是滚动条的当前值自动在最小到最大值之间来回移动,形成这样一个动画效果,这个只是告诉别人“我正在工作”,但不能提示工作进度到哪个阶段。主要是在进行一些无法确定操作时间的任务时作为提示。而“明确”(true)就是根据你的进度可以设置现在的进度值。
ProgressBar的indeterminateDrawable属性在安卓6.0上的问题- http://blog.csdn.net/baiyuliang2013/article/details/50767034
<ProgressBar
  android:indeterminateBehavior="repeat"
  android:indeterminateOnly="true"
            android:id="@+id/loading_circle_progressBar"
            android:layout_width="25dp"
            android:layout_height="25dp"
            android:layout_centerInParent="true"
            android:indeterminate="false"
            android:indeterminateDrawable="@drawable/circle_progress"
            android:visibility="visible" />


> ImageView

ImageView充满全部控件 android:scaleType="fitXY"

原创粉丝点击