Search in sources :

Example 51 with LayoutParams

use of android.widget.LinearLayout.LayoutParams in project glitch-hq-android by tinyspeck.

the class EncyclopediaStreetDetailFragment method showEncyclopediaStreetPage.

private void showEncyclopediaStreetPage() {
    TextView title = (TextView) m_root.findViewById(R.id.street_detail_title);
    title.setTypeface(m_application.m_vagFont);
    title.setText(m_street.name + " in " + m_hub.name);
    ImageView image = (ImageView) m_root.findViewById(R.id.street_detail_image);
    DrawableURL.Show(image, m_street.image, false);
    Button setDestinationButton = (Button) m_root.findViewById(R.id.street_detail_set_as_destination_btn);
    setDestinationButton.setTypeface(m_application.m_vagFont);
    setDestinationButton.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            FlurryAgent.logEvent("Street Detail - Tapped set as destination button");
            setAsDestination();
        }
    });
    TextView visits = (TextView) m_root.findViewById(R.id.street_detail_visits);
    if (m_street.visits > 0) {
        String visitedText = "You've been here <b>" + m_street.visits + "</b> time";
        if (m_street.visits > 1) {
            visitedText += "s";
        }
        visitedText += ".";
        visits.setText(Html.fromHtml(visitedText));
    } else {
        visits.setText("You've never been here before!");
    }
    LinearLayout features = (LinearLayout) m_root.findViewById(R.id.street_detail_features);
    features.removeAllViews();
    if (m_street.features != null) {
        for (int i = 0; i < m_street.features.size(); i++) {
            String feature = m_street.features.get(i);
            TextView featureTv = new TextView(getActivity());
            LayoutParams featureParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
            featureTv.setLayoutParams(featureParams);
            featureTv.setPadding(10, 2, 10, 2);
            featureTv.setTextSize(14);
            featureTv.setTextColor(Color.parseColor("#505050"));
            featureTv.setText(Html.fromHtml(feature));
            features.addView(featureTv);
        }
        features.setVisibility(View.VISIBLE);
    }
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams) Button(android.widget.Button) OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) TextView(android.widget.TextView) ScrollView(android.widget.ScrollView) View(android.view.View) LinearLayout(android.widget.LinearLayout)

Example 52 with LayoutParams

use of android.widget.LinearLayout.LayoutParams in project ViewPagerIndicator by JakeWharton.

the class TestFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    TextView text = new TextView(getActivity());
    text.setGravity(Gravity.CENTER);
    text.setText(mContent);
    text.setTextSize(20 * getResources().getDisplayMetrics().density);
    text.setPadding(20, 20, 20, 20);
    LinearLayout layout = new LinearLayout(getActivity());
    layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
    layout.setGravity(Gravity.CENTER);
    layout.addView(text);
    return layout;
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams) TextView(android.widget.TextView) LinearLayout(android.widget.LinearLayout)

Example 53 with LayoutParams

use of android.widget.LinearLayout.LayoutParams in project FlycoDialog_Master by H07000223.

the class ActionSheetDialog method onCreateView.

@Override
public View onCreateView() {
    LinearLayout ll_container = new LinearLayout(mContext);
    ll_container.setOrientation(LinearLayout.VERTICAL);
    ll_container.setBackgroundColor(Color.TRANSPARENT);
    /** title */
    mTvTitle = new TextView(mContext);
    mTvTitle.setGravity(Gravity.CENTER);
    mTvTitle.setPadding(dp2px(10), dp2px(5), dp2px(10), dp2px(5));
    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    params.topMargin = dp2px(20);
    ll_container.addView(mTvTitle, params);
    /** title underline */
    mVLineTitle = new View(mContext);
    ll_container.addView(mVLineTitle);
    /** listview */
    mLv = new ListView(mContext);
    mLv.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, 1));
    mLv.setCacheColorHint(Color.TRANSPARENT);
    mLv.setFadingEdgeLength(0);
    mLv.setVerticalScrollBarEnabled(false);
    mLv.setSelector(new ColorDrawable(Color.TRANSPARENT));
    ll_container.addView(mLv);
    /** mCancel btn */
    mTvCancel = new TextView(mContext);
    mTvCancel.setGravity(Gravity.CENTER);
    LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    lp.topMargin = dp2px(7);
    lp.bottomMargin = dp2px(7);
    mTvCancel.setLayoutParams(lp);
    ll_container.addView(mTvCancel);
    return ll_container;
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams) ListView(android.widget.ListView) ColorDrawable(android.graphics.drawable.ColorDrawable) TextView(android.widget.TextView) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) LinearLayout(android.widget.LinearLayout)

Example 54 with LayoutParams

use of android.widget.LinearLayout.LayoutParams in project android_frameworks_base by ParanoidAndroid.

the class GlyphCacheActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ScrollView scrollView = new ScrollView(this);
    scrollView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    LinearLayout layout = new LinearLayout(this);
    layout.setOrientation(LinearLayout.VERTICAL);
    layout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    scrollView.addView(layout);
    while (mTotalChars < 10000) {
        layout.addView(createTextView());
    }
    setContentView(scrollView);
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams) ScrollView(android.widget.ScrollView) LinearLayout(android.widget.LinearLayout)

Example 55 with LayoutParams

use of android.widget.LinearLayout.LayoutParams in project android_frameworks_base by ParanoidAndroid.

the class GlyphCacheActivity method createTextView.

private TextView createTextView() {
    TextView textview = new TextView(this);
    textview.setTextSize(6 + (int) (Math.random() * 5) * 10);
    textview.setTextColor(0xff << 24 | (int) (Math.random() * 255) << 16 | (int) (Math.random() * 255) << 8 | (int) (Math.random() * 255) << 16);
    textview.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    int numChars = 5 + (int) (Math.random() * 10);
    mTotalChars += numChars;
    textview.setText(createString(numChars));
    return textview;
}
Also used : LayoutParams(android.widget.LinearLayout.LayoutParams) TextView(android.widget.TextView)

Aggregations

LayoutParams (android.widget.LinearLayout.LayoutParams)78 LinearLayout (android.widget.LinearLayout)44 View (android.view.View)36 TextView (android.widget.TextView)24 ImageView (android.widget.ImageView)17 Button (android.widget.Button)16 ProgressBar (android.widget.ProgressBar)9 Message (android.os.Message)8 OnClickListener (android.view.View.OnClickListener)8 ScrollView (android.widget.ScrollView)7 Handler (android.os.Handler)6 ViewGroup (android.view.ViewGroup)6 WebView (android.webkit.WebView)6 HorizontalScrollView (android.widget.HorizontalScrollView)5 ChangeBounds (android.transition.ChangeBounds)4 Crossfade (android.transition.Crossfade)4 Scene (android.transition.Scene)4 TransitionSet (android.transition.TransitionSet)4 SurfaceView (android.view.SurfaceView)4 TextureView (android.view.TextureView)4