Skip to content

Commit d384857

Browse files
committed
bugfix: topbar in TranslucentActivity
1 parent 627d7df commit d384857

2 files changed

Lines changed: 22 additions & 16 deletions

File tree

qmuidemo/src/main/java/com/qmuiteam/qmuidemo/activity/TranslucentActivity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import com.qmuiteam.qmui.arch.annotation.LatestVisitRecord;
2626
import com.qmuiteam.qmui.arch.record.RecordArgumentEditor;
2727
import com.qmuiteam.qmui.widget.QMUITopBar;
28+
import com.qmuiteam.qmui.widget.QMUITopBarLayout;
2829
import com.qmuiteam.qmuidemo.R;
2930
import com.qmuiteam.qmuidemo.base.BaseActivity;
3031

@@ -39,7 +40,7 @@
3940
@LatestVisitRecord
4041
public class TranslucentActivity extends BaseActivity {
4142

42-
@BindView(R.id.topbar) QMUITopBar mTopBar;
43+
@BindView(R.id.topbar) QMUITopBarLayout mTopBar;
4344

4445
@Override
4546
protected void onCreate(Bundle savedInstanceState) {
@@ -55,7 +56,6 @@ protected void onCreate(Bundle savedInstanceState) {
5556
}
5657

5758
private void initTopBar() {
58-
mTopBar.setBackgroundColor(ContextCompat.getColor(this, R.color.app_color_theme_4));
5959
mTopBar.addLeftBackImageButton().setOnClickListener(new View.OnClickListener() {
6060
@Override
6161
public void onClick(View v) {

qmuidemo/src/main/res/layout/activity_translucent.xml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,31 @@
1515
limitations under the License.
1616
-->
1717

18-
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
18+
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
1919
android:layout_width="match_parent"
2020
android:layout_height="match_parent"
21-
android:background="@color/app_color_theme_4"
2221
android:fitsSystemWindows="true"
2322
android:orientation="vertical">
2423

25-
<com.qmuiteam.qmui.widget.QMUITopBar
24+
<FrameLayout
25+
android:layout_width="match_parent"
26+
android:layout_height="match_parent"
27+
android:layout_marginTop="?attr/qmui_topbar_height"
28+
android:fitsSystemWindows="true">
29+
<TextView
30+
android:layout_width="match_parent"
31+
android:layout_height="match_parent"
32+
android:background="@color/qmui_config_color_white"
33+
android:gravity="center"
34+
android:padding="30dp"
35+
android:text="@string/statusBarHelper_translucentActivity_desc"/>
36+
</FrameLayout>
37+
38+
<com.qmuiteam.qmui.widget.QMUITopBarLayout
2639
android:id="@+id/topbar"
2740
android:layout_width="match_parent"
28-
android:layout_height="?attr/qmui_topbar_height"/>
41+
android:layout_height="wrap_content"
42+
android:background="@color/app_color_theme_4"
43+
android:fitsSystemWindows="true"/>
2944

30-
<TextView
31-
android:layout_width="match_parent"
32-
android:layout_height="0dp"
33-
android:layout_weight="1"
34-
android:background="@color/qmui_config_color_white"
35-
android:gravity="center"
36-
android:padding="30dp"
37-
android:text="@string/statusBarHelper_translucentActivity_desc"/>
38-
39-
</LinearLayout>
45+
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout>

0 commit comments

Comments
 (0)