Category : layout

I was trying to create a proof of concept with android studio, and I was trying to create one transition between fragments. I have tried the next code: public class PartnersFragment extends Fragment { PartnerController controller = new PartnerController(); private TableLayout partnersView; @Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState ) { // ..

Read more

I am writing an app which has both light and dark modes as declared here: styles.xml <style name="Noon" parent="Theme.AppCompat.NoActionBar"> <item name="upper_bg">@drawable/day_sky_top</item> <item name="lower_bg">@drawable/day_sky</item> <item name="android:statusBarColor">@color/colorPrimaryDark</item> </style> <style name="Night" parent="Theme.AppCompat.NoActionBar"> <item name="upper_bg">@drawable/night_sky_top</item> <item name="lower_bg">@drawable/night_sky</item> <item name="android:statusBarColor">@color/colorNightDark</item> </style> By following this answer, I created the following file: /res/values/attrs.xml <?xml version="1.0" encoding="utf-8"?> <resources> <declare-styleable name="customAttrs"> <attr name="upper_bg" format="reference" ..

Read more

having problems on android to get View with layoutInflater by using dynamically string as id. This code works: LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View newView = layoutInflater.inflate(R.layout.my_layout, null); scrollViewMain.removeAllViews(); scrollViewMain.addView(newView); But I want to get the view dynamically by using a string like this: String myString = "my_layout"; LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View newView ..

Read more

I have a problem with a fragment layout for Wear project. I have a WearActivity which just hosts a FragmentContainerView to support navigation graph. Inside I have a HomeFragment with the following layout: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" app:boxedEdges="all"> <ScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/black" android:paddingBottom="32dp"> <LinearLayout android:id="@+id/llWearContent" android:layout_width="match_parent" android:layout_height="0dp" android:orientation="vertical"> <ImageButton android:id="@+id/notifications_ibtn" android:layout_width="wrap_content" ..

Read more

I am trying to use FlexboxLayoutManager to layout square shape items. However the last row has only two items so that they centre align. That makes things look super bad. My code is below. Is there a way to fix this? FlexboxLayoutManager layoutManager = new FlexboxLayoutManager(activity); layoutManager.setFlexDirection(FlexDirection.ROW); layoutManager.setJustifyContent(JustifyContent.SPACE_BETWEEN); Source: Android..

Read more

I have androidx.core.widget.NestedScrollView with MaterialCardView and RecyclerViewBelow. <androidx.core.widget.NestedScrollView 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:id="@+id/pool_activity_root_layout" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".view.activity.TicketActivity" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" android:layout_height="match_parent"> <com.google.android.material.card.MaterialCardView android:id="@+id/card" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="16dp" android:elevation="1dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" android:layout_height="match_parent"> … </androidx.constraintlayout.widget.ConstraintLayout> </com.google.android.material.card.MaterialCardView> <androidx.recyclerview.widget.RecyclerView android:id="@+id/comments_list_row" android:layout_width="0dp" android:layout_height="match_parent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/card" /> </androidx.constraintlayout.widget.ConstraintLayout> </androidx.core.widget.NestedScrollView> In RecyclerView I have some EditTexts. On focus Soft keybord ..

Read more