我正在使用
那么如何根据sdp编程来更改边距?谢谢。
compile 'com.intuit.sdp:sdp-android:1.0.3'
API 来设置线性布局的边距,如下所示。<LinearLayout
android:id="@+id/layout_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/_10sdp"
android:layout_marginTop="@dimen/_10sdp"
android:padding="@dimen/_8sdp"
android:orientation="vertical">
</LinearLayout>
现在当我以编程方式更改边距时,它会以dp而不是sdp的方式更改。
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.setMargins(0, 10, 10, 0);
layout_message.setLayoutParams(params);
那么如何根据sdp编程来更改边距?谢谢。