CircleImageView图片的显示

//需添加两个依赖:
compile 'de.hdodenhof:circleimageview:2.2.0'
compile 'com.github.bumptech.glide:glide:3.7.0'

//布局文件
<Button android:onClick="click" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" a
ndroid:text="点我获得网络图片"/>
<de.hdodenhof.circleimageview.CircleImageView 
android:id="@+id/civ" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" />

//数据
public class MainActivity extends AppCompatActivity {
    String imgerUrl ="http://img.my.csdn.net/uploads/201407/26/1406383265_8550.jpg";
    private CircleImageView circleImageView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        circleImageView = findViewById(R.id.civ);
    }
    public void click(View v){

        Glide.with(this).load(imgerUrl).into(circleImageView);

    }
}
阅读更多
换一批

没有更多推荐了,返回首页