android.widget.TextView.getGravity()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(153)

本文整理了Java中android.widget.TextView.getGravity()方法的一些代码示例,展示了TextView.getGravity()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextView.getGravity()方法的具体详情如下:
包路径:android.widget.TextView
类名称:TextView
方法名:getGravity

TextView.getGravity介绍

暂无

代码示例

代码示例来源:origin: square/assertj-android

public S hasGravity(@TextViewGravity int gravity) {
 isNotNull();
 int actualGravity = actual.getGravity();
 //noinspection ResourceType
 assertThat(actualGravity) //
   .overridingErrorMessage("Expected gravity <%s> but was <%s>.", gravityToString(gravity),
     gravityToString(actualGravity)) //
   .isEqualTo(gravity);
 return myself;
}

代码示例来源:origin: robolectric/robolectric

@Test
public void testGetGravity() throws Exception {
 assertThat(textView.getGravity()).isNotEqualTo(Gravity.CENTER);
 textView.setGravity(Gravity.CENTER);
 assertThat(textView.getGravity()).isEqualTo(Gravity.CENTER);
}

代码示例来源:origin: willowtreeapps/Hyperion-Android

attributes.add(new ViewAttribute<>("AutoSizeStepGranularity",
    TextViewCompat.getAutoSizeStepGranularity(view)));
attributes.add(new ViewAttribute<>("Gravity", new GravityValue(view.getGravity())));

代码示例来源:origin: AriesHoo/UIWidget

@Override
  public void run() {
    int lineCount = mTvMessage.getLineCount();
    if (lineCount > 1) {
      mTvMessage.setGravity(Gravity.LEFT | mTvMessage.getGravity());
    }
    if (mOnTextViewLineListener != null) {
      mOnTextViewLineListener.onTextViewLineListener(mTvMessage, lineCount);
    }
  }
});

代码示例来源:origin: stackoverflow.com

if (textViewFileName.getGravity() != Gravity.CENTER) {
  textViewFileName.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);

代码示例来源:origin: com.squareup.assertj/assertj-android

public S hasGravity(@TextViewGravity int gravity) {
 isNotNull();
 int actualGravity = actual.getGravity();
 //noinspection ResourceType
 assertThat(actualGravity) //
   .overridingErrorMessage("Expected gravity <%s> but was <%s>.", gravityToString(gravity),
     gravityToString(actualGravity)) //
   .isEqualTo(gravity);
 return myself;
}

代码示例来源:origin: NightscoutFoundation/xDrip

padding_store_left_1 = viewHolder.layout.getPaddingLeft();
padding_store_right_1 = viewHolder.layout.getPaddingRight();
gravity_store_1 = viewHolder.name.getGravity();

代码示例来源:origin: jamorham/xDrip-plus

padding_store_left_1 = viewHolder.layout.getPaddingLeft();
padding_store_right_1 = viewHolder.layout.getPaddingRight();
gravity_store_1 = viewHolder.name.getGravity();

代码示例来源:origin: bzsome/VirtualApp-x326

switch (textView.getTextAlignment()) {
  case TextView.TEXT_ALIGNMENT_GRAVITY:
    switch (textView.getGravity() & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) {
      case Gravity.START:
        alignment = Layout.Alignment.ALIGN_NORMAL;

代码示例来源:origin: darkskygit/VirtualApp

switch (textView.getTextAlignment()) {
  case TextView.TEXT_ALIGNMENT_GRAVITY:
    switch (textView.getGravity() & Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) {
      case Gravity.START:
        alignment = Layout.Alignment.ALIGN_NORMAL;

代码示例来源:origin: googlesamples/android-unsplash

public TextResizeData(TextView textView) {
    this.paddingLeft = textView.getPaddingLeft();
    this.paddingTop = textView.getPaddingTop();
    this.paddingRight = textView.getPaddingRight();
    this.paddingBottom = textView.getPaddingBottom();
    this.width = textView.getWidth();
    this.height = textView.getHeight();
    this.gravity = textView.getGravity();
    this.textColor = textView.getCurrentTextColor();
  }
}

代码示例来源:origin: jbruchanov/AnUitor

values.put("LinksClickable", tv.getLinksClickable());
values.put("MovementMethod", String.valueOf(tv.getMovementMethod()));
values.put("Gravity", translator.gravity(tv.getGravity()));
values.put("AutoLinkMask", translator.linkMask(tv.getAutoLinkMask()));
values.put("Ellipsize", String.valueOf(tv.getEllipsize()));

代码示例来源:origin: DroidsOnRoids/Workcation

public TextResizeData(TextView textView) {
    this.paddingLeft = textView.getPaddingLeft();
    this.paddingTop = textView.getPaddingTop();
    this.paddingRight = textView.getPaddingRight();
    this.paddingBottom = textView.getPaddingBottom();
    this.width = textView.getWidth();
    this.height = textView.getHeight();
    this.gravity = textView.getGravity();
    this.textColor = textView.getCurrentTextColor();
  }
}

相关文章

TextView类方法