android.view.ViewGroup.LayoutParams
public static final int FILL_PARENT html
Special value for the height or width requested by a View. FILL_PARENT means that the view wants to be as big as its parent, minus the parent's padding, if any. This value is deprecated starting in API Level 8 and replaced by MATCH_PARENT
. android
Constant Value: -1 (0xffffffff)
api
////////////////////////////////////////////////////
app
private void applyTo(View target) {ide
LayoutParams lp = target.getLayoutParams();
ViewParent parent = target.getParent();
FrameLayout container = new FrameLayout(context);
if (target instanceof TabWidget) {
// set target to the relevant tab child container
target = ((TabWidget) target).getChildTabViewAt(targetTabIndex);
this.target = target;
((ViewGroup) target).addView(container, post
new LayoutParams(LayoutParams.
MATCH_PARENT, LayoutParams.MATCH_PARENT));
//new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));ui
最好是根據版原本 Build.VERSION.SDK_INT;this
請參考:spa
As described in the android documentation, the SDK level (integer) the phone is running is available in:.net
android.os.Build.VERSION.SDK_INT;
The enum corresponding to this int is in the android.os.Build.VERSION_CODES class.
Code example:
int currentapiVersion = android.os.Build.VERSION.SDK_INT; if (currentapiVersion >= android.os.Build.VERSION_CODES.FROYO){ // Do something for froyo and above versions } else{ // do something for phones running an SDK before froyo }
Edit: This SDK_INT is available since Donut (android 1.6 / API4) so make sure your application is not retro-compatible with Cupcake (android 1.5 / API3) when you use it or your application will crash (thanks to Programmer Bruce for the precision).
Corresponding android documentation:
http://developer.android.com/reference/android/os/Build.VERSION.html#SDK_INT
http://developer.android.com/reference/android/os/Build.VERSION_CODES.html