ImageView

来源:互联网 发布:服装软件管理系统 编辑:程序博客网 时间:2024/06/04 01:12
<ImageView        android:src="@drawable/gakki"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:scaleType="centerCrop" />

首先在drawable里面导入图片,gakki.jpg
然后调用时android:src=”@drawable/gakki”,不用加图片的拓展名
这里写图片描述
这张图转载来自http://blog.csdn.net/u012947056/article/details/46816153
使用scaleType=”centerCrop”时,是无边框,给人身临其境的感觉

google chrome搜索页面中信息时,windows ctr+F
mac cmd+ F

 <LinearLayout       xmlns:android="http://schemas.android.com/apk/res/android"       android:layout_width="match_parent"       android:layout_height="match_parent">    <TextView        android:id="@+id/text_view_id"        android:layout_height="wrap_content"        android:layout_width="wrap_content"        android:text="@string/hello" /> </LinearLayout>  public class MainActivity extends Activity {    protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.activity_main);         final TextView helloTextView = (TextView) findViewById(R.id.text_view_id);         helloTextView.setText(R.string.user_greeting);     }This code sample demonstrates how to modify the contents of the text view defined in the previous XML layout:
原创粉丝点击