프로그래밍 방식으로 UI 컨트롤을 만들고 내 EditText가 화면에 나타나지 않아야합니다.Android : 프로그래밍 방식으로 스타일을 설정할 때 EditText가 표시되지 않습니다.
이것은 테이블 행을 프로그래밍 방식으로 추가하는 일종의 스켈레톤 XML입니다.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:paddingLeft="20dp"
android:id="@+id/main_layout">
<TableLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:id="@+id/myTable" >
</TableLayout>
</LinearLayout>
</ScrollView>
이는
TableLayout mainTable = (TableLayout) findViewById(R.id.myTable);
TableRow row = new TableRow(this);
TextView textView = new TextView(this);
textView.setText("Text1");
row.addView(textView);
EditText editText = new EditText(this, null, R.style.editTextStyle);
row.addView(editText);
mainTable.addView(row);
내 editTextStyle은 다음과 같다, 내 활동에 자바 코드
<style name="editTextStyle">
<item name="android:paddingTop">10dp</item>
<item name="android:paddingLeft">7dp</item>
<item name="android:textSize">27sp</item>
<item name="android:layout_width">150dp</item>
<item name="android:layout_height">50dp</item>
</style>
텍스트 뷰가 정상적으로 표시되지만 글고 아니다. 어떤 아이디어라도 제발?
당신은 내가 layout_width와 layout_height를 추가 –
@ChintanRaghwani 당신의 텍스트 뷰에 lauoyt/크기를 추가하지 않은 내 스타일로. –