下面是一个 textview 布局,我希望在代码中将 layout_marginRight 修改为零。
<TextView
android:id="@+id/status1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginRight="@dimen/keyguard_lockscreen_status_line_font_right_margin"
android:singleLine="true"
android:ellipsize="marquee"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="@dimen/keyguard_lockscreen_status_line_font_size"
android:drawablePadding="4dip"
/>
当我将 aqif 代码复制到我的代码如下时,手机在开机动画时暂停。
private void updateStatus1() {
if (mStatus1View != null) {
MutableInt icon = new MutableInt(0);
CharSequence string = getPriorityTextMessage(icon);
mStatus1View.setText(string);
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mStatus1View.getLayoutParams();
params.rightMargin = 0;
mStatus1View.setLayoutParams(params);
mStatus1View.setCompoundDrawablesWithIntrinsicBounds(icon.value, 0, 0, 0);
mStatus1View.setVisibility(mShowingStatus ? View.VISIBLE : View.INVISIBLE);
}
}