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);
}
}
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;
}
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;
}
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);
}
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;
}
Aggregations