Example usage for android.view View setBackgroundColor

List of usage examples for android.view View setBackgroundColor

Introduction

In this page you can find the example usage for android.view View setBackgroundColor.

Prototype

@RemotableViewMethod
public void setBackgroundColor(@ColorInt int color) 

Source Link

Document

Sets the background color for this view.

Usage

From source file:com.conferenceengineer.android.iosched.ui.ExploreFragment.java

@Override
public void onViewCreated(final View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    view.setBackgroundColor(Color.WHITE);

    final ListView listView = getListView();
    listView.setSelector(android.R.color.transparent);
    listView.setCacheColorHint(Color.WHITE);

    mAdapter = new TracksAdapter(getActivity(), false);
    setListAdapter(mAdapter);/*from  w  ww. j a  v  a2s  .  c  o  m*/

    // Override default ListView empty-view handling
    listView.setEmptyView(null);
    mEmptyView.setVisibility(View.VISIBLE);
    mAdapter.registerDataSetObserver(new DataSetObserver() {
        @Override
        public void onChanged() {
            if (mAdapter.getCount() > 0) {
                mEmptyView.setVisibility(View.GONE);
                mAdapter.unregisterDataSetObserver(this);
            }
        }
    });
}

From source file:com.hookedonplay.decoviewsample.SampleEndcapFragment.java

@Override
protected void createTracks() {
    setDemoFinished(false);/*from   w w w .  j a v a2  s .c om*/
    final View view = getView();
    final DecoView decoView = getDecoView();
    if (view == null || decoView == null) {
        return;
    }

    view.setBackgroundColor(Color.argb(255, 196, 196, 128));

    decoView.executeReset();
    decoView.deleteAll();

    final float mSeriesMax = 100f;

    SeriesItem seriesBack1Item = new SeriesItem.Builder(COLOR_BACK).setRange(0, mSeriesMax, mSeriesMax)
            .setLineWidth(getDimension(40)).build();

    decoView.addSeries(seriesBack1Item);

    SeriesItem series1Item = new SeriesItem.Builder(COLOR_NEUTRAL).setRange(0, mSeriesMax, 0)
            .setInitialVisibility(false).setLineWidth(getDimension(30)).setEndCap(EndCapType.CAP_CONCAVE)
            .setShowPointWhenEmpty(true)
            .addEdgeDetail(new EdgeDetail(EdgeDetail.EdgeType.EDGE_INNER, COLOR_EDGE, 0.3f)).build();

    mSeries1Index = decoView.addSeries(series1Item);

    TextView textListener = (TextView) view.findViewById(R.id.textProgress);
    addFitListener(series1Item, textListener);
}

From source file:com.laer.easycast.FirstPane.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View root = new View(getActivity());
    root.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    root = inflater.inflate(R.layout.firstlayout, container, false);
    root.setBackgroundColor(Color.GRAY);
    setHasOptionsMenu(true);//from ww w . j ava2  s .  co  m
    myViewGroup = container;

    return root;
}

From source file:org.lol.reddit.activities.CommentListingActivity.java

public void onCreate(final Bundle savedInstanceState) {

    PrefsUtility.applyTheme(this);

    super.onCreate(savedInstanceState);

    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    OptionsMenuUtility.fixActionBar(this, getString(R.string.app_name));

    sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    sharedPreferences.registerOnSharedPreferenceChangeListener(this);

    final boolean solidblack = PrefsUtility.appearance_solidblack(this, sharedPreferences)
            && PrefsUtility.appearance_theme(this, sharedPreferences) == PrefsUtility.AppearanceTheme.NIGHT;

    // TODO load from savedInstanceState

    final View layout = getLayoutInflater().inflate(R.layout.main_single);
    if (solidblack)
        layout.setBackgroundColor(Color.BLACK);
    setContentView(layout);/*from   w  w w . ja va2s . c o m*/

    RedditAccountManager.getInstance(this).addUpdateListener(this);

    if (getIntent() != null) {

        final Intent intent = getIntent();

        final String url = intent.getDataString();
        controller = new CommentListingController(RedditURLParser.parseProbableCommentListing(Uri.parse(url)),
                this);

        doRefresh(RefreshableFragment.COMMENTS, false);

    } else {
        throw new RuntimeException("Nothing to show! (should load from bundle)"); // TODO
    }
}

From source file:com.gdgdevfest.android.apps.devfestbcn.ui.ExploreFragment.java

@Override
public void onViewCreated(final View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    view.setBackgroundColor(Color.WHITE);

    final ListView listView = getListView();
    listView.setSelector(android.R.color.transparent);
    listView.setCacheColorHint(Color.WHITE);
    addMapHeaderView();//from  w  w  w .  ja  v  a  2 s .  c o m

    mAdapter = new TracksAdapter(getActivity(), false);
    setListAdapter(mAdapter);

    // Override default ListView empty-view handling
    listView.setEmptyView(null);
    mEmptyView.setVisibility(View.VISIBLE);
    mAdapter.registerDataSetObserver(new DataSetObserver() {
        @Override
        public void onChanged() {
            if (mAdapter.getCount() > 0) {
                mEmptyView.setVisibility(View.GONE);
                mAdapter.unregisterDataSetObserver(this);
            }
        }
    });
}

From source file:com.hippo.scene.SceneFragment.java

@Override
@SuppressWarnings("deprecation")
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    view.setTag(R.id.fragment_tag, getTag());
    view.setBackgroundColor(getResources().getColor(R.color.background_light));

    // Notify//  w ww.  j a  v a  2  s  .  c  o  m
    FragmentActivity activity = getActivity();
    if (activity instanceof StageActivity) {
        ((StageActivity) activity).onSceneViewCreated(this, savedInstanceState);
    }
}

From source file:com.conferenceengineer.android.iosched.ui.SandboxFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    view.setBackgroundColor(Color.WHITE);
    final ListView listView = getListView();
    listView.setSelector(android.R.color.transparent);
    listView.setCacheColorHint(Color.WHITE);
}

From source file:com.dm.material.dashboard.candybar.fragments.FAQsFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.menu_search, menu);
    MenuItem search = menu.findItem(R.id.menu_search);
    int color = ColorHelper.getAttributeColor(getActivity(), R.attr.toolbar_icon);

    SearchView searchView = (SearchView) MenuItemCompat.getActionView(search);
    searchView.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
    searchView.setQueryHint(getActivity().getResources().getString(R.string.search_faqs));
    searchView.setMaxWidth(Integer.MAX_VALUE);

    ViewHelper.changeSearchViewTextColor(searchView, color, ColorHelper.setColorAlpha(color, 0.6f));
    View view = searchView.findViewById(android.support.v7.appcompat.R.id.search_plate);
    if (view != null)
        view.setBackgroundColor(Color.TRANSPARENT);

    searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {

        @Override/*from   ww  w. ja v  a2 s .c o m*/
        public boolean onQueryTextChange(String string) {
            filterSearch(string);
            return true;
        }

        @Override
        public boolean onQueryTextSubmit(String string) {
            searchView.clearFocus();
            return true;
        }
    });
    super.onCreateOptionsMenu(menu, inflater);
}

From source file:org.deviceconnect.android.uiapp.fragment.profile.FileProfileFragment.java

@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
        final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    View view = inflater.inflate(R.layout.fragment_file_service, container, false);
    view.setBackgroundColor(getResources().getColor(android.R.color.background_light));

    // ?//ww w  .  java  2  s  .c o  m
    List<Map<String, Object>> empty = new ArrayList<Map<String, Object>>();
    mListAdapter = new ListAdapter(getActivity(), empty);

    // ListView?
    mListView = (ListView) view.findViewById(R.id.listview);
    mListView.setAdapter(mListAdapter);
    mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(final AdapterView<?> parent, final View view, final int position,
                final long id) {
            @SuppressWarnings("unchecked")
            final Map<String, Object> item = (Map<String, Object>) mListAdapter.getItem(position);
            int type = (Integer) item.get(FileProfileConstants.PARAM_FILE_TYPE);
            if (type == FileProfileConstants.FileType.FILE.getValue()) {
                // ??
                String path = (String) item.get(FileProfileConstants.PARAM_PATH);
                GetFileListTask task = new GetFileListTask();
                task.execute(path);
            }
        }
    });
    // 
    GetFileListTask task = new GetFileListTask();
    task.execute();
    return view;
}

From source file:com.ryan.ryanreader.activities.CommentListingActivity.java

public void onCreate(final Bundle savedInstanceState) {

    PrefsUtility.applyTheme(this);

    super.onCreate(savedInstanceState);

    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    OptionsMenuUtility.fixActionBar(this, getString(R.string.app_name));

    sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    sharedPreferences.registerOnSharedPreferenceChangeListener(this);

    final boolean solidblack = PrefsUtility.appearance_solidblack(this, sharedPreferences)
            && PrefsUtility.appearance_theme(this, sharedPreferences) == PrefsUtility.AppearanceTheme.NIGHT;

    // TODO load from savedInstanceState

    final View layout = getLayoutInflater().inflate(R.layout.main_single);
    if (solidblack)
        layout.setBackgroundColor(Color.BLACK);
    setContentView(layout);//from  w ww.j a v a2  s. co  m

    RedditAccountManager.getInstance(this).addUpdateListener(this);

    if (getIntent() != null) {

        final Intent intent = getIntent();

        if (intent.hasExtra("postId")) {
            final String postId = intent.getStringExtra("postId");
            controller = new CommentListingController(postId, this);

        } else {

            final String url = intent.getDataString();
            controller = new CommentListingController(Uri.parse(url), this);
        }

        doRefresh(RefreshableFragment.COMMENTS, false);

    } else {
        throw new RuntimeException("Nothing to show! (should load from bundle)"); // TODO
    }
}