Posts

Showing posts with the label android-layout

How do I hide the navigation bar in the editor for android studio?

How do I hide the navigation bar in the editor for android studio? How do I make the bottom navigation bar disappear in the visual XML editor in Android Studio? I added a screenshot of the navigation bar which I want to remove. I have looked at both of these and they were no help to me. How to hide navigation bar permanently in android activity? How to emulate immersive mode in layout editor Here is the screenshot of the Navigation bar: https://imgur.com/gallery/GlmDsIs Here is my XML Code for activity_main: <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#474747" tools:context=".Main...

How to utilise seperate ConstraintSet actions for different TextViews in the same ConstraintLayout?

How to utilise seperate ConstraintSet actions for different TextViews in the same ConstraintLayout? My question follows on from this question: Android : How to programatically set layout_constraintRight_toRightOf "parent". I have the written the following code that should constrain the new TextView to either the left (btnSendL) or the right (btnSendR) of a ConstraintLayout. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final ConstraintLayout clMessagesContainer = (ConstraintLayout) findViewById(R.id.clMessagesContainer); final EditText txtMessage = (EditText) findViewById(R.id.txtMessage); Button btnSendL = (Button) findViewById(R.id.btnSendL); Button btnSendR = (Button) findViewById(R.id.btnSendR); btnSendL.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { TextView lblNxtMessage =...

How to increase the the limit of items showing in recyclerView

How to increase the the limit of items showing in recyclerView Basically I have made a RecyclerView in which I am showing all my data. At this stage code is working properly, data is showing in RecyclerView . But this is showing only nine items in the RecyclerView , not showing more. My data is greater than 9, how will I increase the limit of my data showing? RecyclerView RecyclerView RecyclerView in my fragment I have set data in recyclerView as private void setInfo(ArrayList<CategoriesItem> arrayListCategory){ categoriesAdapter = new CategoriesAdapter(context, arrayListCategory); rvCategories.setLayoutManager(new GridLayoutManager(context, 2,GridLayoutManager.VERTICAL,false)); rvCategories.setAdapter(categoriesAdapter); categoriesAdapter.notifyDataSetChanged(); } and mt adapter is public class CategoriesAdapter extends RecyclerView.Adapter<CategoriesAdapter.ViewHolder> { private ArrayList<CategoriesItem> categories; private Context...

BottomSheetDialog background blinking

Image
BottomSheetDialog background blinking BottomSheetDialog 's background is blinking when switching between apps. What am I doing wrong ? BottomSheetDialog MainActivity.java public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); findViewById(R.id.btn1).setOnClickListener(v -> { BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(MainActivity.this); bottomSheetDialog.setContentView(R.layout.content); bottomSheetDialog.show(); }); } } activity_main.xml <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" andro...

Change background color of single specific menu items of navigationView

Image
Change background color of single specific menu items of navigationView I want to set the background color of all header items in a android menu within a navigation drawer. My layout looks like: <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:title="TopItem" android:id="@+id/top_item1"> // Here i want to set the background <menu> <group> <item android:id="@+id/sub_item1" android:title="SubItem" /> // Here no background </group> </menu> </item> <item android:title="TopItem" android:id="@+id/top_item2"> <menu> <group> <item android:id="@+id/sub_item2" android:title="SubItem" /> <item android:id="@+id/sub_item3" android:title="SubItem" /> <item android:id="@+id/sub...