Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fragment没有跟着activity适配 #799

Closed
Bruce8hou opened this issue Jan 15, 2019 · 4 comments
Closed

fragment没有跟着activity适配 #799

Bruce8hou opened this issue Jan 15, 2019 · 4 comments

Comments

@Bruce8hou
Copy link

Describe the bug

A clear and concise description of what the bug is.

  • The version of utilcode:
  • The device:
  • The version of device:

The code of bug

put your code here

The stack of crash

put the stack of crash here

Screenshots

If applicable, add screenshots to help explain your problem.

Please delete the current line and the followings.

Thank you for supporting AndroidUtilCode.

@Blankj
Copy link
Owner

Blankj commented Jan 15, 2019

上图和代码啊?

@Bruce8hou
Copy link
Author

Bruce8hou commented Jan 15, 2019

我刚刚重新建立了一个工程 好像适配不生效 :`public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
}

@Override
public Resources getResources() {
    return  AdaptScreenUtils.adaptHeight( super.getResources(),1920);
    //return super.getResources();
}

}`
布局:

<?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"
    tools:context=".MainActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <ImageView
        android:layout_width="300dp"
        android:layout_height="500dp"
        android:background="@color/colorPrimary"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

</android.support.constraint.ConstraintLayout>

分辨率 14402560
qq 20190115155958
分辨率 1080
1920
qq 20190115155948

@Blankj
Copy link
Owner

Blankj commented Jan 15, 2019

#758
看下文章,单位是 pt

@Bruce8hou
Copy link
Author

Bruce8hou commented Jan 15, 2019

我这个项目比较大 布局比较多 之前都是dp为单位 我现在是要把所有的dp都换成pt(包括字体sp也要换成pt) 才能在不同的分辨率设备上适配对吗

@Blankj Blankj closed this as completed Jan 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants