Пример #1
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ActionBar actionBar = activity.getActionBar();
    View view = actionBar.getCustomView();
    ImageView title_image = (ImageView) view.findViewById(R.id.title_image);
    title_image.setBackgroundResource(R.drawable.substancea_cs);

    ScrollView sv = new ScrollView(activity);
    sv.setLayoutParams(
        new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    sv.setFillViewport(true);

    LinearLayout lay = new LinearLayout(activity);
    lay.setOrientation(LinearLayout.VERTICAL);
    lay.setBackgroundColor(Color.WHITE);
    LinearLayout.LayoutParams params =
        new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    sv.addView(lay, params);
    // setContentView(sv);

    search_lay.setOnClickListener(searchLis);
    search_btn.setOnClickListener(searchLis);
    showLinelay = new LinearLayout(activity);
    ((LinearLayout) showLinelay).setOrientation(LinearLayout.VERTICAL);
    lay.addView(showLinelay, params);
    initNet();
    loadData(new RequestPram());
  }
Пример #2
0
    @Override
    public View onCreateView(
        LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      if (container == null) {
        // We have different layouts, and in one of them this
        // fragment's containing frame doesn't exist.  The fragment
        // may still be created from its saved state, but there is
        // no reason to try to create its view hierarchy because it
        // won't be displayed.  Note this is not needed -- we could
        // just run the code below, where we would create and return
        // the view hierarchy; it would just never be used.
        return null;
      }

      ScrollView scroller = new ScrollView(getActivity());
      TextView text = new TextView(getActivity());
      int padding =
          (int)
              TypedValue.applyDimension(
                  TypedValue.COMPLEX_UNIT_DIP, 4, getActivity().getResources().getDisplayMetrics());
      text.setPadding(padding, padding, padding, padding);
      scroller.addView(text);
      text.setText(Shakespeare.DIALOGUE[getShownIndex()]);
      return scroller;
    }
Пример #3
0
 private void process_content_view() {
   if (ContentView != null) {
     ScrollView sv = (ScrollView) findViewById(R.id.mindpin_alert_dialog_content_panel_scrollView);
     sv.removeAllViews();
     sv.addView(ContentView);
   }
 }
Пример #4
0
  private void dialogie(String s) {
    if (s == null || s.length() == 0) return;

    AlertDialog ad = new AlertDialog.Builder(me).create();
    ad.setCancelable(true);
    ad.setCanceledOnTouchOutside(true);
    ad.setTitle("Linkification view");

    LinearLayout rl = new LinearLayout(me);
    rl.setBackgroundColor(Color.WHITE);
    rl.setPadding(scalemex(5), scalemex(25), scalemex(5), scalemex(25));

    TextView tv;

    tv = new TextView(me);
    rl.addView(tv);
    tv.setBackgroundColor(Color.WHITE);
    tv.setTextColor(Color.BLACK);
    tv.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 19f);
    tv.setText(s);
    Linkify.addLinks(tv, Linkify.ALL);

    ScrollView ho = new ScrollView(me);
    ho.addView(rl);

    ad.setView(ho);
    ad.show();
  }
Пример #5
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_reserve_seats);

    final Button cancel = (Button) findViewById(R.id.cancel_res_button);
    cancel.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View V) {
            intnt = new Intent();
            setResult(RESULT_OK, intnt);
            finish();
          }
        });

    final Button save = (Button) findViewById(R.id.save_res_button);
    save.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            intnt = new Intent();
            setResult(RESULT_OK, intnt);
            finish();
          }
        });

    TableLayout tl = CreateSeatsLayout();

    ScrollView sc = (ScrollView) findViewById(R.id.reserve_scroll);
    sc.addView(tl);
  }
Пример #6
0
 private View createView() {
   ArrayList<String> addrs = getNetworkAddresses();
   ScrollView parent = new ScrollView(this);
   int fill = LinearLayout.LayoutParams.FILL_PARENT;
   int wrap = LinearLayout.LayoutParams.WRAP_CONTENT;
   LinearLayout.LayoutParams fillAll = new LinearLayout.LayoutParams(fill, fill);
   parent.setLayoutParams(fillAll);
   layout = new LinearLayout(this);
   layout.setOrientation(LinearLayout.VERTICAL);
   layout.setLayoutParams(new LinearLayout.LayoutParams(fill, wrap));
   parent.addView(layout);
   text(R.string.desc_setup_wifi, 20);
   text(R.string.desc_goto_settings);
   text(R.string.desc_enable_kbd);
   text(R.string.desc_toch_input_field);
   text(R.string.desc_change_input_method);
   text("", 15);
   if (addrs.size() == 0) {
     text("Enable wifi or GPRS/3G", 20);
   } else if (addrs.size() == 1) {
     text(getString(R.string.desc_connect_to_one, addrs.get(0), port), 20);
   } else {
     text(R.string.desc_connect_to_any);
     for (String addr : addrs) {
       text("http://" + addr + ":" + port, 20);
     }
   }
   text(R.string.desc_warn);
   text("", 15);
   text(R.string.desc_alt_usb_cable, 20);
   text(R.string.desc_adb_from_sdk);
   text(getString(R.string.desc_cmdline, port, port), 15);
   text(getString(R.string.desc_connect_local, port), 15);
   return parent;
 }
Пример #7
0
 public CustomDialog(Context context) {
   super(context);
   items = new ArrayList<>();
   icon = getContext().getResources().getDimensionPixelSize(R.dimen.dimen_32_dp);
   padding = getContext().getResources().getDimensionPixelSize(R.dimen.dimen_8_dp);
   ViewGroup.LayoutParams params =
       new ViewGroup.LayoutParams(
           ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
   container = new LinearLayout(getContext());
   container.setLayoutParams(params);
   container.setBackgroundColor(Color.WHITE);
   container.setOrientation(LinearLayout.VERTICAL);
   container.setPadding(0, padding, 0, padding);
   ScrollView scrollView = new ScrollView(getContext());
   scrollView.addView(container);
   requestWindowFeature(Window.FEATURE_NO_TITLE);
   setContentView(scrollView, params);
   setCancelable(true);
   setCanceledOnTouchOutside(true);
   getWindow().setGravity(Gravity.BOTTOM);
   getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
   getWindow()
       .setLayout(
           WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);
   getWindow().getAttributes().windowAnimations = R.style.DialogAnimation;
 }
Пример #8
0
  private void init() {

    totalPages = 2;
    Display display =
        ((WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
    screenWidth = display.getWidth();
    screenHeight = display.getHeight();
    //
    mBookView = new CurlView(mContext, screenWidth, screenHeight);
    // prepare view to take all screenshoot
    LinearLayout ll = new LinearLayout(mContext);
    ll.setOrientation(LinearLayout.VERTICAL);
    LayoutInflater factory = LayoutInflater.from(mContext);
    View view = factory.inflate(R.layout.scrach_page, null);
    ll.addView(view, screenWidth, screenHeight);
    View view2 = factory.inflate(R.layout.scrach_page, null);
    ll.addView(view2, screenWidth, screenHeight);
    // hide scrollview's commponent to have clear bitmap
    scrollView = new ScrollView(mContext);
    scrollView.addView(ll);
    scrollView.setVerticalScrollBarEnabled(false);
    scrollView.setHorizontalScrollBarEnabled(false);
    scrollView.setFadingEdgeLength(0);
    addView(scrollView);
    // add true view and some actions
    View view3 = factory.inflate(R.layout.scrach_page, null);
    addView(view3, screenWidth, screenHeight);
    View view4 = factory.inflate(R.layout.scrach_page, null);
    addView(view4, screenWidth, screenHeight);

    addView(mBookView);
    mBookView.setView(view3, view4);
    // view 1

  }
Пример #9
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_main);
    scroller = (ScrollView) findViewById(R.id.scroller);
    doneButton = (Button) findViewById(R.id.done);
    desk = new ShuffleDesk(this, scroller);
    scroller.addView(desk);
    getButtons();

    desk.getViewTreeObserver()
        .addOnGlobalLayoutListener(
            new OnGlobalLayoutListener() {

              @SuppressWarnings("deprecation")
              @Override
              public void onGlobalLayout() {
                desk.getViewTreeObserver().removeGlobalOnLayoutListener(this);
                desk.InitDatas();
                desk.initView();
              }
            });

    doneButton.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            commitChange(desk.getButtons());
          }
        });
  }
Пример #10
0
  public View inflateViews() {
    mScrollView = new ScrollView(getActivity());
    ViewGroup.LayoutParams scrollParams =
        new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    mScrollView.setLayoutParams(scrollParams);

    mLogView = new LogView(getActivity());
    ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams(scrollParams);
    logParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
    mLogView.setLayoutParams(logParams);
    mLogView.setClickable(true);
    mLogView.setFocusable(true);
    mLogView.setTypeface(Typeface.MONOSPACE);

    // Want to set padding as 16 dips, setPadding takes pixels.  Hooray math!
    int paddingDips = 16;
    double scale = getResources().getDisplayMetrics().density;
    int paddingPixels = (int) ((paddingDips * (scale)) + .5);
    mLogView.setPadding(paddingPixels, paddingPixels, paddingPixels, paddingPixels);
    mLogView.setCompoundDrawablePadding(paddingPixels);

    mLogView.setGravity(Gravity.BOTTOM);
    mLogView.setTextAppearance(getActivity(), android.R.style.TextAppearance_Holo_Medium);

    mScrollView.addView(mLogView);
    return mScrollView;
  }
Пример #11
0
 @Override
 public void addView(View content, int index) {
   if (getChildCount() == 0) {
     super.addView(content, index);
   } else {
     mContentLayout.addView(content, index);
   }
 }
 private View scrollWrap(View view) {
   ScrollView scroller = new ScrollView(this);
   scroller.addView(
       view,
       new ScrollView.LayoutParams(
           ScrollView.LayoutParams.MATCH_PARENT, ScrollView.LayoutParams.MATCH_PARENT));
   return scroller;
 }
Пример #13
0
 @Override
 public void initView() {
   pullView = (PullToRefreshScrollView) this.findViewById(R.id.lo_pullview);
   mLocationResult = new TextView(mContext);
   scrollView = pullView.getRefreshableView();
   scrollView.addView(mLocationResult);
   mLocationClient = new LocationClient(this.getApplicationContext());
   mLocationClient.registerLocationListener(new MyLocationListener());
 }
Пример #14
0
  public void onCreate(Bundle bundle) {
    super.onCreate(bundle);

    tv = new TextView(this);
    sv = new ScrollView(this);
    sv.addView(tv);
    setContentView(sv);

    testThread.start();
  }
Пример #15
0
 public MaximViewer(Context context) {
   super(context);
   this.context = context;
   setOrientation(LinearLayout.VERTICAL);
   util = new Util(context);
   header = new HeaderView(context, util, navigationHandler());
   scrollView = new ScrollView(context);
   table = new TableLayout(context);
   scrollView.addView(table);
   addView(header);
   addView(scrollView);
 }
Пример #16
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   LinearLayout l = new LinearLayout(this);
   l.setOrientation(LinearLayout.VERTICAL);
   ScrollView sv = new ScrollView(this);
   sv.addView(l);
   this.setContentView(sv);
   testCharButton(this, l);
   testLineView(this, l);
   testCircleLinebutton(this, l);
 }
  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    final OsmandApplication app = ((OsmandApplication) getApplication());

    LinearLayout gl = new LinearLayout(this);
    gl.setOrientation(LinearLayout.VERTICAL);
    gl.setPadding(3, 3, 3, 3);

    TextView tv = new TextView(this);
    tv.setText(
        "Press buttons and listen various voice instructions, if you don't hear anything probably they are missed.");
    tv.setPadding(0, 5, 0, 7);

    ScrollView sv = new ScrollView(this);
    gl.addView(
        sv,
        new LayoutParams(
            android.view.ViewGroup.LayoutParams.FILL_PARENT,
            android.view.ViewGroup.LayoutParams.FILL_PARENT));
    final LinearLayout ll = new LinearLayout(this);
    ll.setOrientation(LinearLayout.VERTICAL);
    sv.addView(
        ll,
        new LayoutParams(
            android.view.ViewGroup.LayoutParams.FILL_PARENT,
            android.view.ViewGroup.LayoutParams.FILL_PARENT));

    // add buttons
    setContentView(gl);
    Runnable r =
        new Runnable() {

          @Override
          public void run() {
            CommandPlayer p = app.getRoutingHelper().getVoiceRouter().getPlayer();
            if (p == null) {
              Toast.makeText(
                      TestVoiceActivity.this, "Voice player not initialized", Toast.LENGTH_SHORT)
                  .show();
            } else {
              addButtons(ll, p);
            }
          }
        };
    if (app.getRoutingHelper().getVoiceRouter().getPlayer() != null) {
      r.run();
    } else {
      app.showDialogInitializingCommandPlayer(this, true, r);
    }
  }
    public TiVerticalScrollView(Context context, boolean vertical) {
      super(context);
      setScrollBarStyle(SCROLLBARS_INSIDE_OVERLAY);
      // setFillViewport(true);
      // setScrollContainer(true);

      layout = new TiScrollViewLayout(context, vertical);
      FrameLayout.LayoutParams params =
          new FrameLayout.LayoutParams(
              ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT);
      layout.setLayoutParams(params);
      super.addView(layout, params);
    }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ScrollView scrollView = new ScrollView(this);
    TextView textView = new TextView(this);
    scrollView.addView(textView);

    String data = getIntent().getStringExtra("data");
    if (data != null) {
      textView.setText(data);
    }
    setContentView(scrollView);
  }
Пример #20
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ScrollView scroller = new ScrollView(this);
    TextView tv = new TextView(this);

    calculatePowerOperations(tv, 20);
    calculateVectorOperations(tv);

    scroller.addView(tv);
    setContentView(scroller);
  }
Пример #21
0
 @Override
 public void addView(View content) {
   //		int index = 0;
   if (getChildCount() == 0) {
     super.addView(content);
   } else {
     //			index = mContentLayout.getChildCount();
     //			if (index == 0) {
     //				index = getChildCount();
     //			}
     //			addView(content, index);
     mContentLayout.addView(content);
   }
 }
  @Override
  protected View createLoadedView() {
    ScrollView mScrollView = new ScrollView(UIUtils.getContext());
    mScrollView.setFillViewport(true); // 设置可以填充父窗体
    // 初始化布局,该布局可以自动分配子View位置,保持每一行都能对齐
    FlowLayout mLayout = new FlowLayout(UIUtils.getContext());
    mLayout.setBackgroundResource(R.drawable.grid_item_bg_normal);
    int layoutPadding = UIUtils.dip2px(13);
    mLayout.setPadding(layoutPadding, layoutPadding, layoutPadding, layoutPadding);
    mLayout.setHorizontalSpacing(layoutPadding);
    mLayout.setVerticalSpacing(layoutPadding);

    int textPaddingV = UIUtils.dip2px(4);
    int textPaddingH = UIUtils.dip2px(7);
    int backColor = 0xffcecece;
    int radius = UIUtils.dip2px(5);
    // 代码动态创建一个图片
    GradientDrawable pressDrawable = DrawableUtils.createDrawable(backColor, backColor, radius);
    Random mRdm = new Random();
    for (int i = 0; i < mDatas.size(); i++) {
      TextView tv = new TextView(UIUtils.getContext());
      // 随机颜色的范围0x202020~0xefefef
      int red = 32 + mRdm.nextInt(208);
      int green = 32 + mRdm.nextInt(208);
      int blue = 32 + mRdm.nextInt(208);
      int color = 0xff000000 | (red << 16) | (green << 8) | blue;
      // 创建背景图片选择器
      GradientDrawable normalDrawable = DrawableUtils.createDrawable(color, backColor, radius);
      StateListDrawable selector = DrawableUtils.createSelector(normalDrawable, pressDrawable);
      tv.setBackgroundDrawable(selector);

      final String text = mDatas.get(i);
      tv.setText(text);
      tv.setTextColor(Color.rgb(255, 255, 255));
      tv.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
      tv.setGravity(Gravity.CENTER);
      tv.setPadding(textPaddingH, textPaddingV, textPaddingH, textPaddingV);
      tv.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              UIUtils.showToastSafe(text);
            }
          });
      mLayout.addView(tv);
    }
    mScrollView.addView(mLayout);
    return mScrollView;
  }
  public static ScrollView LinkifyText(Context context, String message) {
    ScrollView svMessage = new ScrollView(context);
    TextView tvMessage = new TextView(context);

    SpannableString spanText = new SpannableString(message);

    Linkify.addLinks(spanText, Linkify.ALL);
    tvMessage.setText(spanText);
    tvMessage.setMovementMethod(LinkMovementMethod.getInstance());

    svMessage.setPadding(14, 2, 10, 12);
    svMessage.addView(tvMessage);

    return svMessage;
  }
  private void initView() {
    if (driving_license_card_verify_view == null) {
      driving_license_card_verify_view =
          LayoutInflater.from(context).inflate(R.layout.layout_driving_license_check, null);

      driving_license_card_verify_view
          .findViewById(R.id.vg_car_brand)
          .setOnClickListener(new CarBrandClickListener());
      driving_license_card_verify_view
          .findViewById(R.id.layout_car_plate)
          .setOnClickListener(new CarPlateNumClickListener());
      driving_license_card_verify_view
          .findViewById(R.id.vg_hold_property)
          .setOnClickListener(new HoldPropertyClickListener());
      driving_license_card_verify_view
          .findViewById(R.id.vg_use_property)
          .setOnClickListener(new UsePropertyClickListener());
      driving_license_card_verify_view
          .findViewById(R.id.vg_capacity)
          .setOnClickListener(new CapacityClickListener());
      driving_license_card_verify_view
          .findViewById(R.id.vg_nianjian_youxiaoqi)
          .setOnClickListener(new DatePickerClickListener());
      driving_license_card_verify_view
          .findViewById(R.id.vg_registration_date)
          .setOnClickListener(new DatePickerClickListener());

      driving_license_card_verify_view
          .findViewById(R.id.vg_success)
          .setOnClickListener(new PassClickListener());
      driving_license_card_verify_view
          .findViewById(R.id.btn_save)
          .setOnClickListener(new SaveClickListener());
      driving_license_card_verify_view
          .findViewById(R.id.vg_fail)
          .setOnClickListener(new RejectClickListener());

      if (!UIUtils.isEmpty(
          context.task_detail_entity.getLicense().getDriverLicense().getFailedNote())) {
        TextView tv_reject_reason =
            (TextView) driving_license_card_verify_view.findViewById(R.id.tv_reject_reason);
        tv_reject_reason.setVisibility(View.VISIBLE);
        tv_reject_reason.setText(
            context.task_detail_entity.getLicense().getDriverLicense().getFailedNote());
      }
    }
    vg_content.addView(driving_license_card_verify_view);
  }
Пример #25
0
 public void add(AndroidViewComponent component) {
   if (resourceId != -1) {
     ((android.widget.ScrollView) ((Form) context).findViewById(resourceId))
         .addView(
             component.getView(),
             new android.widget.LinearLayout.LayoutParams(
                 ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, 0f));
   } else {
     layoutManager.addView(
         component.getView(),
         new android.widget.LinearLayout.LayoutParams(
             ViewGroup.LayoutParams.WRAP_CONTENT, // width
             ViewGroup.LayoutParams.WRAP_CONTENT, // height
             0f)); // weight
   }
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    ScrollView sv = new ScrollView(getActivity());
    TableLayout tl = new TableLayout(getActivity());
    sv.addView(tl);

    if (displayReportController == null) {
      return sv;
    }
    AdsenseReportsGenerateResponse response = displayReportController.getReportResponse();

    TableLayout.LayoutParams tableRowParams =
        new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    tableRowParams.setMargins(10, 10, 10, 10);

    TableRow.LayoutParams tvParams =
        new TableRow.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    tvParams.setMargins(10, 10, 10, 10);

    List<Headers> headers = response.getHeaders();
    TableRow tr = new TableRow(getActivity());
    tl.addView(tr);

    for (Headers header : headers) {
      TextView tv = new TextView(getActivity());
      tv.setText(header.getName());
      tr.setLayoutParams(tableRowParams);
      tr.addView(tv);
    }
    if (response.getRows() != null && !response.getRows().isEmpty()) {
      for (List<String> row : response.getRows()) {
        TableRow trow = new TableRow(getActivity());
        tl.addView(trow);
        for (String cell : row) {
          TextView tv = new TextView(getActivity());
          tv.setText(cell);
          trow.addView(tv);
          tv.setLayoutParams(tvParams);
          tv.setPadding(15, 5, 15, 5);
          tv.setBackgroundColor(Color.WHITE);
        }
      }
    }
    return sv;
  }
 @Override
 public View onCreateView(
     LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   ScrollView sv = new ScrollView(this.getActivity().getApplicationContext());
   TableLayout tableLayout = new TableLayout(this.getActivity().getApplicationContext());
   sv.addView(tableLayout);
   TableRow tableRow;
   TextView textView;
   File dir = new File(Environment.getExternalStorageDirectory() + "/PhotoAR/");
   File[] filelist = dir.listFiles();
   //			f.getName()
   //		{ // do your stuff here }
   if (filelist != null) {
     for (File f : filelist) {
       tableRow = new TableRow(this.getActivity().getApplicationContext());
       textView = new TextView(this.getActivity().getApplicationContext());
       Calendar cal = Calendar.getInstance(Locale.ENGLISH);
       cal.setTimeInMillis(Long.valueOf(f.getName().replace(".jpg", "")));
       String date = DateFormat.format("dd-MM-yyyy hh:mm:ss", cal).toString();
       ExifInterface exif = null;
       String message = "";
       try {
         exif = new ExifInterface(f.getCanonicalPath());
         message = exif.getAttribute("UserComment");
       } catch (IOException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
       }
       textView.setText(date + " " + message);
       textView.setPadding(20, 20, 20, 20);
       tableRow.addView(textView);
       tableLayout.addView(tableRow);
     }
   } else {
     tableRow = new TableRow(this.getActivity().getApplicationContext());
     textView = new TextView(this.getActivity().getApplicationContext());
     textView.setText("[No Submissions]");
     textView.setPadding(20, 20, 20, 20);
     tableRow.addView(textView);
     tableLayout.addView(tableRow);
   }
   //		setContentView(tableLayout);
   View rootView = sv;
   //		View rootView = inflater.inflate(R.layout.coming_soon_layout, container, false);
   return rootView;
 }
Пример #28
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    System.out.println("大家好");

    ScrollView scrollView = new ScrollView(this);

    mFlowLayout = new FlowLayout(this);
    mFlowLayout.setPadding(8, 8, 8, 8);

    final Random random = new Random();

    for (int i = 0; i < 100; i++) {
      final TextView textView = new TextView(this);
      textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
      int nextInt = random.nextInt(1000) + 10;

      textView.setText(nextInt + "");

      Drawable normal = DrawableUtil.getGradientDrawable(ColorUtil.getRandomColor());
      Drawable pressed = DrawableUtil.getGradientDrawable(Color.GRAY);

      Drawable selector = DrawableUtil.getDrawableSelector(normal, pressed);

      textView.setBackgroundDrawable(selector);

      textView.setGravity(Gravity.CENTER_HORIZONTAL);
      textView.setPadding(5, 2, 5, 2);

      textView.setOnClickListener(
          new OnClickListener() {

            @Override
            public void onClick(View v) {
              Toast.makeText(MainActivity.this, textView.getText().toString(), 0).show();
              ;
            }
          });

      mFlowLayout.addView(textView);
    }

    scrollView.addView(mFlowLayout);

    setContentView(scrollView);
  }
Пример #29
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);

    // Set the ScrollView
    ScrollView scroller = new ScrollView(this);
    // Set the TextView
    TextView tv = new TextView(this);

    // Set the data at TextView
    tv.setText(NewsActivity.newsdescriptionvector.get(NewsActivity.index));

    scroller.addView(tv);

    setContentView(scroller);
  }
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.typein);
   try {
     Intent intent = getIntent();
     if (null == intent) {
       finish();
       return;
     }
     String[] saved = intent.getStringArrayExtra(SAVED);
     if (null == saved) {
       finish();
       return;
     }
     Type type = Types.restoreType(saved, Files.types());
     if (null == type) {
       finish();
       return;
     }
     Program program = type.restore(saved);
     if (null == program) {
       finish();
       return;
     }
     scrollView = (ScrollView) findViewById(R.id.sourceCodeVScroll);
     sourceView = new SourceView(this, type, program);
     ViewGroup.LayoutParams params =
         new ViewGroup.LayoutParams(
             ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
     sourceView.setLayoutParams(params);
     sourceView.setTextLayout(textLayout());
     sourceView.setTextSize(textSize());
     sourceView.setVisibleWhitesapces(visibleWhitespaces());
     scrollView.addView(sourceView);
     scrollView.setOnTouchListener(new OnTouch(this));
     registerForContextMenu(scrollView);
     if (keepScreenOn()) {
       getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
     }
   } catch (Throwable throwable) {
     AndroidErrorHandler.d(throwable);
     finish();
   }
 }