Java Code Examples for android.widget.FrameLayout#setForegroundGravity()

The following examples show how to use android.widget.FrameLayout#setForegroundGravity() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TopAnimHandler.java    From bither-bitmap-sample with Apache License 2.0 6 votes vote down vote up
public CellHolder(LayoutInflater inflater) {
    fl = (FrameLayout) inflater.inflate(
            R.layout.list_item_top_grid_item, null);

    iv = (ImageView) fl.findViewById(R.id.iv);
    ivAnimated = (ImageView) fl
            .findViewById(R.id.iv_animated);
    flContainer = (FrameLayout) fl.findViewById(R.id.fl);
    Drawable foreground = inflater.getContext().getResources()
            .getDrawable(R.drawable.grid_photo_overlay);
    foreground.getPadding(paddingRect);
    fl.setForeground(foreground);
    fl.setPadding(paddingRect.left, paddingRect.top, paddingRect.right,
            paddingRect.bottom);
    fl.setForegroundGravity(Gravity.FILL);


}
 
Example 2
Source File: FrameLayoutStyler.java    From dynamico with Apache License 2.0 5 votes vote down vote up
@Override
public View style(View view, JSONObject attributes) throws Exception {
    super.style(view, attributes);

    FrameLayout frameLayout = (FrameLayout) view;

    if(attributes.has("measureAllChildren")) {
        frameLayout.setMeasureAllChildren(attributes.getBoolean("measureAllChildren"));
    }

    if(attributes.has("foregroundGravity")) {
        String gravity = attributes.getString("foregroundGravity");

        if(gravity.equalsIgnoreCase("start")) {
            frameLayout.setForegroundGravity(Gravity.START);
        }else if(gravity.equalsIgnoreCase("top")) {
            frameLayout.setForegroundGravity(Gravity.TOP);
        }else if(gravity.equalsIgnoreCase("end")) {
            frameLayout.setForegroundGravity(Gravity.END);
        }else if(gravity.equalsIgnoreCase("bottom")) {
            frameLayout.setForegroundGravity(Gravity.BOTTOM);
        }else if(gravity.equalsIgnoreCase("center")) {
            frameLayout.setForegroundGravity(Gravity.CENTER);
        }else if(gravity.equalsIgnoreCase("center_horizontal")) {
            frameLayout.setForegroundGravity(Gravity.CENTER_HORIZONTAL);
        }else if(gravity.equalsIgnoreCase("center_vertical")) {
            frameLayout.setForegroundGravity(Gravity.CENTER_VERTICAL);
        }
    }

    return frameLayout;
}
 
Example 3
Source File: BaseQuickAdapter.java    From BigApp_Discuz_Android with Apache License 2.0 5 votes vote down vote up
private View createIndeterminateProgressView(View convertView,
		ViewGroup parent)
{
	if (convertView == null)
	{
		FrameLayout container = new FrameLayout(context);
		container.setForegroundGravity(Gravity.CENTER);
		ProgressBar progress = new ProgressBar(context);
		container.addView(progress);
		convertView = container;
	}
	return convertView;
}
 
Example 4
Source File: BaseQuickAdapter.java    From BigApp_WordPress_Android with Apache License 2.0 5 votes vote down vote up
private View createIndeterminateProgressView(View convertView,
		ViewGroup parent)
{
	if (convertView == null)
	{
		FrameLayout container = new FrameLayout(context);
		container.setForegroundGravity(Gravity.CENTER);
		ProgressBar progress = new ProgressBar(context);
		container.addView(progress);
		convertView = container;
	}
	return convertView;
}
 
Example 5
Source File: BaseQuickAdapter.java    From AndroidBase with Apache License 2.0 5 votes vote down vote up
private View createIndeterminateProgressView(View convertView, ViewGroup parent) {
    if (convertView == null) {
        FrameLayout container = new FrameLayout(context);
        container.setForegroundGravity(Gravity.CENTER);
        ProgressBar progress = new ProgressBar(context);
        container.addView(progress);
        convertView = container;
    }
    return convertView;
}
 
Example 6
Source File: BaseQuickAdapter.java    From VSigner with GNU General Public License v2.0 5 votes vote down vote up
private View createIndeterminateProgressView(View convertView, ViewGroup parent) {
    if (convertView == null) {
        FrameLayout container = new FrameLayout(context);
        container.setForegroundGravity(Gravity.CENTER);
        ProgressBar progress = new ProgressBar(context);
        container.addView(progress);
        convertView = container;
    }
    return convertView;
}
 
Example 7
Source File: BaseQuickAdapter.java    From UltimateRecyclerView with Apache License 2.0 5 votes vote down vote up
private View createIndeterminateProgressView(View convertView,
                                             ViewGroup parent) {
    if (convertView == null) {
        FrameLayout container = new FrameLayout(context);
        container.setForegroundGravity(Gravity.CENTER);
        ProgressBar progress = new ProgressBar(context);
        container.addView(progress);
        convertView = container;
    }
    return convertView;
}
 
Example 8
Source File: BaseQuickAdapter.java    From android-common-utils with Apache License 2.0 5 votes vote down vote up
static View createIndeterminateProgressView(View convertView,
		ViewGroup parent) {
	if (convertView == null) {
		Context context = parent.getContext();
		FrameLayout container = new FrameLayout(context);
		container.setForegroundGravity(Gravity.CENTER);
		ProgressBar progress = new ProgressBar(context);
		container.addView(progress);
		convertView = container;
	}
	return convertView;
}
 
Example 9
Source File: MainActivity.java    From android-animatedscaledrawable with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
	convertView = mViews[position];
	if(convertView == null){
		
		AnimatedScaleDrawable drawable = new AnimatedScaleDrawable(
			parent.getContext().getResources().getDrawable(R.drawable.heart));
		drawable.setInterpolator(new BounceInterpolator());
		drawable.setInvertTransformation(true);
		drawable.setDuration(500);
		
		FrameLayout frame = (FrameLayout)LayoutInflater.from(parent.getContext())
			.inflate(R.layout.item_frame, parent, false);
		
		if(position == 0){
			// ProgressBar example
			ProgressBar progress = (ProgressBar)LayoutInflater.from(parent.getContext())
				.inflate(R.layout.item_progress, frame, false);
			progress.setIndeterminateDrawable(drawable);
			frame.addView(progress);
		}
		else{
			if(position == 1 || position == 2){
				// Background drawable example
				frame.setBackgroundDrawable(drawable);
				if(position == 2){
					drawable.setUseBounds(false);
				}
			}else{
				// Foreground's with Gravity example
				frame.setForeground(drawable);
				frame.setForegroundGravity(mGravity[position - 3]);
			}
			// no need to call drawable.start() for ProgressBar widgets
			drawable.start();
		}
		
		TextView textView = (TextView)frame.findViewById(R.id.text);
		textView.setText(String.format("#%02d %s", position, mNames[position]));
		
		convertView = frame;
	}
	
	return convertView;
}