标签:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <RelativeLayout android:layout_width="match_parent" android:layout_height="50dp" android:background="@color/white"> <ImageView android:id="@+id/image" android:layout_width="match_parent" android:layout_height="50dp" android:background="@drawable/clip" /> <TextView android:layout_width="match_parent" android:layout_height="50dp" android:gravity="center" android:text="手机存储:大小25.5M/总大小30M" /> </RelativeLayout> </LinearLayout>
package com.example.myapp; import android.app.Activity; import android.graphics.drawable.ClipDrawable; import android.os.Bundle; import android.widget.ImageView; public class MyActivity extends Activity{ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ImageView image = (ImageView) findViewById(R.id.image); ClipDrawable d = (ClipDrawable) image.getBackground(); d.setLevel(d.getLevel()+7000); } }
标签:
原文地址:http://www.cnblogs.com/niuxx-android/p/5412687.html