Skip to content

Commit

Permalink
bugfix: topbar in TranslucentActivity
Browse files Browse the repository at this point in the history
  • Loading branch information
cgspine committed Jan 5, 2020
1 parent 627d7df commit d384857
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.qmuiteam.qmui.arch.annotation.LatestVisitRecord;
import com.qmuiteam.qmui.arch.record.RecordArgumentEditor;
import com.qmuiteam.qmui.widget.QMUITopBar;
import com.qmuiteam.qmui.widget.QMUITopBarLayout;
import com.qmuiteam.qmuidemo.R;
import com.qmuiteam.qmuidemo.base.BaseActivity;

Expand All @@ -39,7 +40,7 @@
@LatestVisitRecord
public class TranslucentActivity extends BaseActivity {

@BindView(R.id.topbar) QMUITopBar mTopBar;
@BindView(R.id.topbar) QMUITopBarLayout mTopBar;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand All @@ -55,7 +56,6 @@ protected void onCreate(Bundle savedInstanceState) {
}

private void initTopBar() {
mTopBar.setBackgroundColor(ContextCompat.getColor(this, R.color.app_color_theme_4));
mTopBar.addLeftBackImageButton().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Expand Down
34 changes: 20 additions & 14 deletions qmuidemo/src/main/res/layout/activity_translucent.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,31 @@
limitations under the License.
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.qmuiteam.qmui.widget.QMUIWindowInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/app_color_theme_4"
android:fitsSystemWindows="true"
android:orientation="vertical">

<com.qmuiteam.qmui.widget.QMUITopBar
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?attr/qmui_topbar_height"
android:fitsSystemWindows="true">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/qmui_config_color_white"
android:gravity="center"
android:padding="30dp"
android:text="@string/statusBarHelper_translucentActivity_desc"/>
</FrameLayout>

<com.qmuiteam.qmui.widget.QMUITopBarLayout
android:id="@+id/topbar"
android:layout_width="match_parent"
android:layout_height="?attr/qmui_topbar_height"/>
android:layout_height="wrap_content"
android:background="@color/app_color_theme_4"
android:fitsSystemWindows="true"/>

<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@color/qmui_config_color_white"
android:gravity="center"
android:padding="30dp"
android:text="@string/statusBarHelper_translucentActivity_desc"/>

</LinearLayout>
</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout>

0 comments on commit d384857

Please sign in to comment.