사각형 버튼을 만들려고합니다. 단추의 높이를 높이면 사라집니다. 그러나 너비를 늘리면 모든 것이 잘됩니다. 거기 무슨 일 이죠?버튼의 높이를 올리면 버튼이 사라집니다.
private void adjustButtons() {
final Button trainerButton = (Button) findViewById(R.id.bu_vocabulary_start_trainer);
trainerButton.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View arg0) {
ViewGroup.LayoutParams params = shareButton.getLayoutParams();
// params.width++; // works fine
params.height++; // button disappears
// params.height = params.width; // what I acutually want to do
shareButton.setLayoutParams(params);
}
});
}
XML 파일
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="30dp"
android:orientation="horizontal" >
<Button
android:id="@+id/bu_vocabulary_start_trainer"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/vocabulary_trainer" />
<Button
android:id="@+id/bu_vocabulary_start_administration"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/vocabulary_administration" />
</LinearLayout>
이 나를 위해 일한 :
당신이 무엇을 할 수 있는지,하지만 같은 것입니다. 그러나 루프에서 높이를 높이면 버튼이 사라집니다. – null