List of usage examples for android.widget FrameLayout setBackgroundColor
@RemotableViewMethod public void setBackgroundColor(@ColorInt int color)
From source file:com.android.tabcarouseldemo.ColorFragment.java
/** * {@inheritDoc}/*w ww.j a va2 s .co m*/ */ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final int color = getArguments().getInt("color"); final FrameLayout root = new FrameLayout(getActivity()); root.setBackgroundColor(color); return root; }
From source file:com.barcamppenang2013.TransparentSupportMapFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup view, Bundle savedInstance) { View layout = super.onCreateView(inflater, view, savedInstance); FrameLayout frameLayout = new FrameLayout(getActivity()); frameLayout.setBackgroundColor(getResources().getColor(android.R.color.transparent)); ((ViewGroup) layout).addView(frameLayout, new ViewGroup.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); return layout; }
From source file:org.telegram.ui.Cells.ChatUnreadCell.java
public ChatUnreadCell(Context context) { super(context); FrameLayout frameLayout = new FrameLayout(context); frameLayout.setBackgroundColor(ContextCompat.getColor(context, R.color.chat_drawable_tint)); //setBackgroundResource(R.drawable.newmsg_divider); frameLayout.setElevation(AndroidUtilities.dp(1)); addView(frameLayout,//from ww w . j a va 2s . c om LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 27, Gravity.LEFT | Gravity.TOP, 0, 8, 0, 4)); ImageView imageView = new ImageView(context); imageView.setImageResource(R.drawable.ic_ab_new); imageView.setPadding(0, AndroidUtilities.dp(2), 0, 0); frameLayout.addView(imageView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.RIGHT | Gravity.CENTER_VERTICAL, 0, 0, 10, 0)); textView = new TextView(context); textView.setPadding(0, 0, 0, AndroidUtilities.dp(1)); textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14); textView.setTextColor(Theme.CHAT_UNREAD_TEXT_COLOR); textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf")); frameLayout.addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER)); }
From source file:com.commnsense.proximity.fragments.SuperAwesomeCardFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); FrameLayout fl = new FrameLayout(getActivity()); fl.setLayoutParams(params);/*w w w .j ava 2 s .co m*/ fl.setBackgroundColor(0xffa9a9a9); final int margin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, getResources().getDisplayMetrics()); TextView v = new TextView(getActivity()); params.setMargins(margin, margin, margin, margin); v.setLayoutParams(params); v.setLayoutParams(params); v.setGravity(Gravity.CENTER); v.setBackgroundResource(R.drawable.background_card); v.setText("CARD " + (position + 1)); fl.addView(v); return fl; }
From source file:com.ameron32.apps.tapnotes._trial._demo.fragment.FlippableStackViewTestFragment.java
private void initAdapter() { mAdapter = new PagerAdapter() { @Override/* w w w . j a va 2s .co m*/ public int getCount() { return colors.length; } @Override public boolean isViewFromObject(View view, Object object) { return view == object; } @Override public Object instantiateItem(ViewGroup container, int position) { // Object o = super.instantiateItem(container, position); final FrameLayout l = new FrameLayout(container.getContext()); l.setBackgroundColor(getColorFrom(position)); container.addView(l); return l; } private int getColorFrom(int position) { return colors[(getCount() - 1) - position]; } @Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView((View) object); } }; }
From source file:com.tfc.baseandroid.ui.fragment.FragmentA.java
@SuppressLint("SetTextI18n") @Nullable/*ww w .j a v a 2 s . c o m*/ @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.f_fragment, container, false); FrameLayout flRoot = (FrameLayout) view.findViewById(R.id.f_fragment_fl_root); TextView tvTitle = (TextView) view.findViewById(R.id.f_fragment_tv_title); flRoot.setBackgroundColor(Color.CYAN); tvTitle.setText("Fragment A"); return view; }
From source file:com.tfc.baseandroid.ui.fragment.FragmentB.java
@SuppressLint("SetTextI18n") @Nullable/* w w w.j a va 2 s . co m*/ @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.f_fragment, container, false); FrameLayout flRoot = (FrameLayout) view.findViewById(R.id.f_fragment_fl_root); TextView tvTitle = (TextView) view.findViewById(R.id.f_fragment_tv_title); flRoot.setBackgroundColor(Color.MAGENTA); tvTitle.setText("Fragment B"); return view; }
From source file:com.avolatile.randomdaily.IntroductionActivitySlideFragment1.java
@Override public void setBackgroundColor(@ColorInt int backgroundColor) { FrameLayout slide1frag = (FrameLayout) getActivity().findViewById(R.id.slide1frag); slide1frag.setBackgroundColor(backgroundColor); }
From source file:com.avolatile.randomdaily.IntroductionActivitySlideFragment2.java
@Override public void setBackgroundColor(@ColorInt int backgroundColor) { FrameLayout slide1frag = (FrameLayout) getActivity().findViewById(R.id.slide2frag); slide1frag.setBackgroundColor(backgroundColor); }
From source file:com.avolatile.randomdaily.IntroductionActivitySlideFragment3.java
@Override public void setBackgroundColor(@ColorInt int backgroundColor) { FrameLayout slide1frag = (FrameLayout) getActivity().findViewById(R.id.slide3frag); slide1frag.setBackgroundColor(backgroundColor); }