关于xml里的android:padding与 android:paddingStart
在这里插入代complexToDimensionPixelSize:338, TypedValue (android.util)
getDimensionPixelSize:777, TypedArray (android.content.res)
<init>:5276, View (android.view)
<init>:974, TextView (android.widget)
<init>:968, TextView (android.widget)
<init>:100, AppCompatTextView (androidx.appcompat.widget)
<init>:95, AppCompatTextView (androidx.appcompat.widget)
createTextView:194, AppCompatViewInflater (androidx.appcompat.app)
createView:115, AppCompatViewInflater (androidx.appcompat.app)
createView:1551, AppCompatDelegateImpl (androidx.appcompat.app)
onCreateView:1602, AppCompatDelegateImpl (androidx.appcompat.app)
tryCreateView:1061, LayoutInflater (android.view)
createViewFromTag:997, LayoutInflater (android.view)
createViewFromTag:961, LayoutInflater (android.view)
rInflate:1123, LayoutInflater (android.view)
rInflateChildren:1084, LayoutInflater (android.view)
inflate:682, LayoutInflater (android.view)
inflate:534, LayoutInflater (android.view)
inflate:481, LayoutInflater (android.view)
setContentView:696, AppCompatDelegateImpl (androidx.appcompat.app)
setContentView:170, AppCompatActivity (androidx.appcompat.app)
onCreate:42, MainActivity (com.example.BarrierFree_demo)
performCreate:7803, Activity (android.app)
performCreate:7792, Activity (android.app)
callActivityOnCreate:1306, Instrumentation (android.app)
performLaunchActivity:3245, ActivityThread (android.app)
handleLaunchActivity:3409, ActivityThread (android.app)
execute:83, LaunchActivityItem (android.app.servertransaction)
executeCallbacks:135, TransactionExecutor (android.app.servertransaction)
execute:95, TransactionExecutor (android.app.servertransaction)
handleMessage:2016, ActivityThread$H (android.app)
dispatchMessage:107, Handler (android.os)
loop:214, Looper (android.os)
main:7356, ActivityThread (android.app)
invoke:-1, Method (java.lang.reflect)
run:492, RuntimeInit$MethodAndArgsCaller (com.android.internal.os)
main:930, ZygoteInit (com.android.internal.os)码片
这里的value永远是xml里的真实值
res是根据显示密度换算的值
设置android:padding=“20dp”
最终-----》view计算出的padding是53
此外,对view设置了android:paddingStart=“70dp”
所以new view时还会记录startPadding