我一直在使用应用程序并在其布局中遇到一个奇怪的故障:
所有观点都发生了这种情况,我花了几个小时试图解决这个问题,但没有成功。 你们知道为什么会这样吗?
clientes_criar_fragment.xml
<Spinner
android:layout_width="381dp"
android:layout_height="wrap_content"
android:id="@+id/clientes_spTipoDocumento"
app:layout_constraintLeft_toLeftOf="@+id/constraintLayout"
android:layout_marginStart="16dp"
app:layout_constraintTop_toBottomOf="@+id/clientes_labelNome"
android:layout_marginTop="8dp" />
<android.support.design.widget.TextInputLayout
android:layout_width="616dp"
android:layout_height="wrap_content"
android:id="@+id/endereco_labelEndereco"
app:layout_constraintLeft_toLeftOf="@+id/constraintLayout"
android:layout_marginStart="16dp"
app:layout_constraintTop_toBottomOf="@+id/clientes_spTipoDocumento"
android:layout_marginTop="8dp">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="@+id/clientes_textDocumento"
android:hint="@string/Documento"
android:layout_weight="1"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="12dp" />
</android.support.design.widget.TextInputLayout>
<it.gmariotti.cardslib.library.view.CardViewNative
android:layout_width="616dp"
android:layout_height="350dp"
android:id="@+id/clientes_enderecos"
style="@style/card_external"
app:layout_constraintLeft_toLeftOf="@+id/constraintLayout"
android:layout_marginStart="16dp"
app:layout_constraintTop_toBottomOf="@+id/clientes_labelInscricaoEstadual"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toBottomOf="@+id/constraintLayout"
android:layout_marginBottom="16dp" />
<it.gmariotti.cardslib.library.view.CardViewNative
android:layout_width="624dp"
android:layout_height="350dp"
android:id="@+id/clientes_contatos"
style="@style/card_external"
app:layout_constraintLeft_toRightOf="@+id/clientes_enderecos"
android:layout_marginStart="8dp"
app:layout_constraintTop_toBottomOf="@+id/clientes_labelLimiteCredito"
android:layout_marginTop="8dp"
app:layout_constraintRight_toRightOf="@+id/constraintLayout"
android:layout_marginEnd="16dp"
app:layout_constraintBottom_toBottomOf="@+id/constraintLayout"
android:layout_marginBottom="16dp" />
<android.support.design.widget.TextInputLayout
android:layout_width="1248dp"
android:layout_height="wrap_content"
android:id="@+id/clientes_labelNome"
app:layout_constraintLeft_toLeftOf="@+id/constraintLayout"
android:layout_marginStart="16dp"
app:layout_constraintTop_toTopOf="@+id/constraintLayout"
android:layout_marginTop="64dp"
app:layout_constraintRight_toRightOf="@+id/constraintLayout"
android:layout_marginEnd="16dp">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="@+id/clientes_textNome"
android:hint="@string/Nome"
android:layout_weight="1"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="12dp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="616dp"
android:layout_height="wrap_content"
android:id="@+id/clientes_labelInscricaoEstadual"
app:layout_constraintLeft_toLeftOf="@+id/constraintLayout"
android:layout_marginStart="16dp"
app:layout_constraintTop_toBottomOf="@+id/endereco_labelEndereco"
android:layout_marginTop="8dp">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:ems="10"
android:id="@+id/clientes_textInscricaoEstadual"
android:hint="@string/Inscricao_Estadual"
android:layout_weight="1"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="12dp" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="624dp"
android:layout_height="wrap_content"
android:id="@+id/clientes_labelLimiteCredito"
app:layout_constraintLeft_toRightOf="@+id/clientes_labelInscricaoEstadual"
android:layout_marginStart="8dp"
app:layout_constraintTop_toBottomOf="@+id/endereco_labelEndereco"
android:layout_marginTop="8dp"
app:layout_constraintRight_toRightOf="@+id/constraintLayout"
android:layout_marginEnd="16dp"
app:layout_constraintHorizontal_bias="0.33">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:ems="10"
android:id="@+id/clientes_textLimiteCredito"
android:hint="@string/limite_de_credito"
android:layout_weight="1"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="12dp" />
</android.support.design.widget.TextInputLayout>
CriarClienteFragment.java
public class CriarClienteFragment extends Fragment {
private ClientesBusiness _clienteBusiness;
private ListagemEnderecoCard _listagemEnderecoCard;
private ListagemContatoCard _listagemContatoCard;
private Spinner _spTipoDocumento;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View viewCriar = inflater.inflate(R.layout.clientes_criar_fragment, null);
this._clienteBusiness = new ClientesBusiness(inflater.getContext(), 0);
this.SetView(viewCriar);
return viewCriar;
}
private void SetView(View view)
{
//Iniciando o dropdown
this._spTipoDocumento = (Spinner) view.findViewById(R.id.clientes_spTipoDocumento);
ArrayAdapter<CharSequence> adaptador = ArrayAdapter.createFromResource(view.getContext(),
R.array.tipo_documento_spinner, android.R.layout.simple_spinner_item);
adaptador.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
this._spTipoDocumento.setAdapter(adaptador);
// Iniciando a visualização da listagem de endereços
this._listagemEnderecoCard = new ListagemEnderecoCard(this.getActivity().getBaseContext(), this._clienteBusiness);
this._listagemEnderecoCard.init();
CardViewNative cardViewEndereco = (CardViewNative) view.findViewById(R.id.clientes_enderecos);
cardViewEndereco.setCard(_listagemEnderecoCard);
// Iniciando a visualização da listagem de contatos
this._listagemContatoCard = new ListagemContatoCard(this.getActivity().getBaseContext(), this._clienteBusiness);
this._listagemContatoCard.init();
CardViewNative cardViewContato = (CardViewNative) view.findViewById(R.id.clientes_contatos);
cardViewContato.setCard(_listagemContatoCard);
}
}
并非所有视图都是碎片,这是我的一个观点,他有这个问题,按钮中的奇怪故障也会发生,他们都有这个奇怪的阴影。它似乎不会发生在上面的棒棒糖中。 如果它遗漏了什么,只要问我编辑。 提前谢谢。