Android LinearLayout.LayoutParams - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android LinearLayout.LayoutParams class.

This code example shows how to use the following methods:
    	Bitmap photo = BitmapCache.getInstance().get(entry.getUser().getProfileImageURL());
 
    	iv.setImageBitmap(photo);
    	iv.setScaleType(ScaleType.CENTER);
    	iv.setPadding(0, 4, 4, 0);
    	iv.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
	 
    	TextView tv = new TextView(context);
    	tv.setText(entry.getUser().getName() + ": " + entry.getText());
    	tv.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
	 
    	LinearLayout layout = new LinearLayout(context);
    	layout.setOrientation(LinearLayout.HORIZONTAL);
    	layout.setPadding(4, 2, 4, 2);
    	layout.addView(iv);
    	layout.addView(tv);
	 
    	return layout;
    } 
} 
6
CodeRank
This code example shows how to use the following methods:
 
	protected void showAd() { 
		this.removeAd();
		View ad = AdsManager.getAd(this);
		if (ad != null) {
			LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
			lp.gravity = Gravity.CENTER_HORIZONTAL;
			adsContainer.addView(ad, lp);
		}		 
	} 
	 
	protected void removeAd() { 
		adsContainer.removeAllViews();
	} 
	 
	@Override 
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);				
		setContentView(R.layout.settings);
		adsContainer = (ViewGroup) findViewById(R.id.adsContainer);
6
CodeRank
This code example shows how to use the following methods:
        webView.setWebViewClient(webViewClient);
        webView.setWebChromeClient(chromeClient);
 
        contentView.addView(webView, new LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT, 0.0f));
 
        handler = new Handler() {
            @Override 
            public void handleMessage(Message msg) {
                switch (msg.what) {
                    case MSG_TIMEOUT:
                        handleTimeout(); 
                        return; 
                    case MSG_NAVIGATE:
                        manualDelay = msg.arg2;
                        navigate(msg.getData().getString(MSG_NAV_URL), msg.arg1);
                        logTime = msg.getData().getBoolean(MSG_NAV_LOGTIME);
                        return; 
                } 
6
CodeRank
This code example shows how to use the following methods:
    NetStatRuler localNetStatRuler = new NetStatRuler(getContext());
    if (paramBoolean);
    for (String str = "wifi"; ; str = "mobile")
    { 
      localNetStatRuler.setTag(str);
      localNetStatRuler.setLayoutParams(new LinearLayout.LayoutParams(-1, -1, 1.0F));
      this.cPX.addView(localNetStatRuler);
      return; 
    } 
  } 
 
  public final void t(int paramInt, boolean paramBoolean)
  { 
    int i = 0;
    String str = DateFormat.format(getContext().getString(2131165530, new Object[] { "" }), 86400000L * paramInt).toString();
    this.aHz.setText(str);
    this.cPX.removeAllViews();
    while (i < 5)
    { 
      NetStatUnit localNetStatUnit = new NetStatUnit(getContext());
5
CodeRank
This code example shows how to use the following methods:
		 
		actInstance = this;
		//web layout  
		m_webLayout = new LinearLayout(this);
		actInstance.addContentView(m_webLayout, 
				new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
	} 
	 
    static { 
         System.loadLibrary("game");
    } 
     
    public static Object getJavaActivity() {
        return actInstance;
    } 
     
    //WebView 
    public void displayWebView(final int x, final int y, final int width, final int height) {
//    	Log.e("Vincent", "showWebView"); 
    	 
5
CodeRank
This code example shows how to use the following methods:
 
	private static final String LOG_TAG = "intentsListView";
 
	LayoutParams params = new LinearLayout.LayoutParams(
			LinearLayout.LayoutParams.WRAP_CONTENT,
			LinearLayout.LayoutParams.WRAP_CONTENT);
 
	@Override 
	public void onCreate(Bundle icicle) {
		super.onCreate(icicle);
		setContentView(R.layout.intents_list);
		LinearLayout view = (LinearLayout) findViewById(R.id.intents_list_container);
		int flags = PackageManager.GET_RESOLVED_FILTER;
 
		Intent intent = new Intent();
		intent.setDataAndType(null, "*/*");
 
		HashMap<String, ArrayList<IntentFilter>> map = new HashMap<String, ArrayList<IntentFilter>>();
 
		if (getIntent() != null) {
5
CodeRank
This code example shows how to use the following methods:getOrientation, setOrientation
        assertSame(params, linearLayout.getLayoutParams());
    } 
 
    @Test 
    public void canAnswerOrientation() throws Exception { 
        assertThat(linearLayout.getOrientation()).isEqualTo(LinearLayout.HORIZONTAL);
        linearLayout.setOrientation(LinearLayout.VERTICAL);
        assertThat(linearLayout.getOrientation()).isEqualTo(LinearLayout.VERTICAL);
        linearLayout.setOrientation(LinearLayout.HORIZONTAL);
        assertThat(linearLayout.getOrientation()).isEqualTo(LinearLayout.HORIZONTAL);
    } 
 
    @Test 
    public void canAnswerGravity() throws Exception { 
        assertThat(shadowOf(linearLayout).getGravity()).isEqualTo(Gravity.TOP | Gravity.START);
        linearLayout.setGravity(Gravity.CENTER_VERTICAL);
        assertThat(shadowOf(linearLayout).getGravity()).isEqualTo(Gravity.CENTER_VERTICAL);
    } 
} 
8
CodeRank
This code example shows how to use the following methods:addView, setOrientation
public class SmallCircleActivity extends Activity {
    @Override 
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
 
        final LinearLayout layout = new LinearLayout(this);
        layout.setOrientation(LinearLayout.VERTICAL);
 
        View view = new PathView(this);
        layout.addView(view, new LinearLayout.LayoutParams(PathView.SIZE, PathView.SIZE));
        view = new PathView(this);
        view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
        layout.addView(view, new LinearLayout.LayoutParams(PathView.SIZE, PathView.SIZE));
 
        setContentView(layout);
    } 
 
    static class PathView extends View {
        private static final int SIZE = 37;
        private final Paint mPaint;
8
CodeRank
This code example shows how to use the following methods:addView, setOrientation
    @Override 
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setBackgroundDrawable(new ColorDrawable(0xff000000));
        SeekBar slider = new SeekBar(this);
        LinearLayout container = new LinearLayout(this);
        container.setOrientation(LinearLayout.VERTICAL);
        setContentView(container);
 
        container.addView(slider);
        slider.setMax(100);
        slider.setProgress(50);
        FrameLayout frame = new FrameLayout(this);
        final RenderingView gpuView = new RenderingView(this, Color.GREEN);
        frame.addView(gpuView);
        final RenderingView swView = new RenderingView(this, Color.RED);
        swView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
        frame.addView(swView);
        container.addView(frame);
 

8
CodeRank
This code example shows how to use the following methods:addView, setOrientation
    } 
 
    private Button createButton(final LinearLayout root) {
        Button button = new Button(this);
        button.setText("Invalidate");
        button.setOnClickListener(new View.OnClickListener() {
            @Override 
            public void onClick(View v) {
                for (int i = 0; i < root.getChildCount(); i++) {
                    View child = root.getChildAt(i);
                    if (child != v) {
                        child.invalidate();
                    } 
                } 
            } 
        }); 
 
        return button;
    } 
 

8
CodeRank

Related Android LinearLayout.LayoutParams Questions & Answers:

See Code Examples for Android LinearLayout.LayoutParams Methods: