Skip to content

Commit 6db122b

Browse files
imhappidsn5ft
authored andcommitted
[SearchBar][Catalog] Update demos to demonstrate an example with a ConstraintLayout
PiperOrigin-RevId: 741241443
1 parent f223b26 commit 6db122b

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

catalog/java/io/material/catalog/search/res/layout/cat_search_appbar_icons_fragment.xml

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,39 +26,51 @@
2626
android:layout_height="wrap_content"
2727
android:fitsSystemWindows="true">
2828

29-
<LinearLayout
29+
<androidx.constraintlayout.widget.ConstraintLayout
3030
android:layout_width="match_parent"
3131
android:layout_height="wrap_content"
3232
android:layout_gravity="center_vertical">
3333
<Button
34-
android:id="@+id/product_logo"
34+
android:id="@+id/cat_home_button"
3535
android:layout_width="48dp"
3636
android:layout_height="48dp"
37+
app:layout_constraintLeft_toLeftOf="parent"
38+
app:layout_constraintTop_toTopOf="parent"
39+
app:layout_constraintBottom_toBottomOf="parent"
40+
android:scaleType="center"
3741
android:layout_marginStart="4dp"
38-
android:layout_marginEnd="8dp"
3942
android:contentDescription="@string/cat_searchbar_home_icon_description"
4043
style="?attr/materialIconButtonStyle"
41-
android:layout_gravity="center_vertical"
4244
app:icon="@drawable/ic_home_default_24px"/>
4345
<com.google.android.material.search.SearchBar
4446
android:id="@+id/cat_search_bar"
4547
android:layout_width="0dp"
4648
android:layout_height="wrap_content"
47-
android:layout_weight="1"
49+
app:layout_constraintLeft_toRightOf="@id/cat_home_button"
50+
app:layout_constraintRight_toLeftOf="@id/cat_cast_button"
51+
app:layout_constraintTop_toTopOf="parent"
52+
app:layout_constraintBottom_toBottomOf="parent"
53+
app:layout_constraintWidth_max="312dp"
4854
android:layout_marginVertical="4dp"
55+
android:layout_marginEnd="8dp"
56+
android:layout_marginStart="8dp"
4957
android:layout_gravity="center_vertical"
5058
app:defaultMarginsEnabled="false"
5159
android:hint="@string/cat_searchbar_short_hint"/>
5260
<Button
61+
android:id="@+id/cat_cast_button"
5362
android:layout_width="48dp"
5463
android:layout_height="48dp"
55-
android:layout_marginStart="8dp"
64+
android:scaleType="center"
5665
android:layout_marginEnd="4dp"
5766
style="?attr/materialIconButtonStyle"
67+
app:layout_constraintTop_toTopOf="parent"
68+
app:layout_constraintBottom_toBottomOf="parent"
69+
app:layout_constraintRight_toRightOf="parent"
5870
android:contentDescription="@string/cat_searchbar_cast_icon_description"
5971
android:layout_gravity="center_vertical"
6072
app:icon="@drawable/ic_cast_vd_theme_24" />
61-
</LinearLayout>
73+
</androidx.constraintlayout.widget.ConstraintLayout>
6274

6375
</com.google.android.material.appbar.AppBarLayout>
6476

catalog/java/io/material/catalog/search/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
<string name="cat_searchbar_recycler_title"
7171
description="Title for recycler view demo.[CHAR_LIMIT=100]">RecyclerView Demo</string>
7272
<string name="cat_searchbar_appbar_with_icons_title"
73-
description="Title for SearchBar in an AppBarLayout with icons demo.[CHAR_LIMIT=NONE]">Searchar in AppBarLayout with Icons Demo</string>
73+
description="Title for SearchBar in an AppBarLayout with icons demo.[CHAR_LIMIT=NONE]">SearchBar in AppBarLayout with Icons Demo</string>
7474
<string name="cat_searchbar_recycler_item_title_prefix"
7575
description="Title for recycler item.[CHAR_LIMIT=40]">Message</string>
7676

0 commit comments

Comments
 (0)