Example usage for android.widget HorizontalScrollView getLayoutParams

List of usage examples for android.widget HorizontalScrollView getLayoutParams

Introduction

In this page you can find the example usage for android.widget HorizontalScrollView getLayoutParams.

Prototype

@ViewDebug.ExportedProperty(deepExport = true, prefix = "layout_")
public ViewGroup.LayoutParams getLayoutParams() 

Source Link

Document

Get the LayoutParams associated with this view.

Usage

From source file:ca.cmput301f13t03.adventure_datetime.view.AuthorEdit_Preview.java

private void setUpView() {
    if (_rootView == null)
        return;/*  w w w  .j av  a 2s.  c  om*/
    if (_fragment == null)
        return;

    /** Layout items **/
    LinearLayout filmLayout = (LinearLayout) _rootView.findViewById(R.id.filmstrip);
    HorizontalScrollView filmstrip = (HorizontalScrollView) _rootView.findViewById(R.id.filmstrip_wrapper);
    TextView content = (TextView) _rootView.findViewById(R.id.content);

    if (_fragment.getStoryMedia() == null)
        _fragment.setStoryMedia(new ArrayList<Image>());

    /** Programmatically set filmstrip height **/
    // TODO : Unshitify this, aka not static value
    if (_fragment.getStoryMedia().size() > 0)
        filmstrip.getLayoutParams().height = 300;

    content.setText(_fragment.getStoryText());

    // 1) Create new ImageView and add to the LinearLayout
    // 2) Set appropriate Layout Params to ImageView
    // 3) Give onClickListener for going to fullscreen
    LinearLayout.LayoutParams lp;
    for (int i = 0; i < _fragment.getStoryMedia().size(); i++) {
        //TODO::JF Get images from fragment
        /*ImageView li = new ImageView(getActivity());
        li.setScaleType(ScaleType.CENTER_INSIDE);
        li.setImageResource(R.drawable.grumpy_cat2);
        filmLayout.addView(li);
                
        lp = (LinearLayout.LayoutParams) li.getLayoutParams();
        lp.setMargins(10, 10, 10, 10);
        lp.width = LayoutParams.WRAP_CONTENT;
        lp.gravity = Gravity.CENTER_VERTICAL;
        li.setLayoutParams(lp);
                
        li.setOnClickListener(new OnClickListener() {
           @Override
           public void onClick(View v) {
              // TODO: Open image in fullscreen
           }
        });*/
    }
}