Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

21
LINES

< > BotCompany Repo | #1008253 // Try to center a LinearLayout horizontally [ARGH]

JavaX source code (Android) [tags: use-pretranspiled] - run with: the app

Libraryless. Click here for Pure Java version (1202L/8K/29K).

!7

import android.widget.*;
import android.view.View;

p {
  androidUI(r {
    LinearLayout ll = new LinearLayout(androidActivity());
    ll.setOrientation(ll.HORIZONTAL);
    Button btn = aButton("TEST");
    ll.addView(btn);
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
      LinearLayout.LayoutParams.WRAP_CONTENT,
      LinearLayout.LayoutParams.WRAP_CONTENT);
    params.gravity = 1; // center_horizontal
    btn.setLayoutParams(params);
    btn.setGravity(1);
    androidShow(aCenterAndSouth(new ASingleComponentPanel, ll));
    //androidShow(new ASingleComponentPanel);
  });
}

Author comment

Began life as a copy of #1008243

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, nbgitpuheiab, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1008253
Snippet name: Try to center a LinearLayout horizontally [ARGH]
Eternal ID of this version: #1008253/13
Text MD5: 673e3e8ea1c1dc9d6163b912921de07c
Transpilation MD5: b9aef14f2a06035cb3d289a7a78d496e
Author: stefan
Category: javax / android
Type: JavaX source code (Android)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-05-03 13:20:16
Source code size: 630 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 504 / 555
Version history: 12 change(s)
Referenced in: [show references]