chuga 버튼을 누르면 그밑에 리니어 레이아웃에
sub1을 띄워야되는데 도통 못해먹겠네요.. 책보고 하는데도
안되니 아주그냥 맨탈이 투쾅투쾅;
싹다 다시할수도 없고
이게 activity_me.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/me1"
android:orientation="vertical"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/tv1"
android:text="chuga"
android:textSize="30dp"
/>
<Button
android:id="@+id/b2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="higi"
/>
<LinearLayout
android:id="@+id/ii1"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
</LinearLayout>
</LinearLayout>
요게 sub1.xml
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/tv2"
android:text="subview1"
android:textSize="30dp"
/>
<CheckBox
android:layout_width="match_parent"
android:text="dongdong"
android:id="@+id/cb1"
android:layout_height="wrap_content" />
</LinearLayout>
이게 me.java
package org.androidtown.gusung;import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.LinearLayout;
import static android.R.attr.button;
import static android.icu.lang.UCharacter.GraphemeClusterBreak.L;
import static org.androidtown.gusung.R.id.b1;
import static org.androidtown.gusung.R.id.ii1;
import static org.androidtown.gusung.R.id.ll1;
public class me extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_me);
ii1=(LinearLayout)findViewById(R.id.ii1);
Button bu=(Button)findViewById(R.id.b2);
bu.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view){
LayoutInflater inf=(LayoutInflater)
getsystemService(Context.LAYOUT_INFLATER_SERVICE);
inf.inflate(R.layout.sub1, ii1,true);
CheckBox ch=(CheckBox)ii1.findViewById(R.id.cb1);
ch.setText ch.setText("로딩되었어요.");
}
});
}
}
제가 c언어 열혈c 한권만 하고 자바 때려치고 안드해서 자바코드를 잘모르겠는데 저 빨간동그라미 친데가
변수선언 같은걸로 제가 대충 처넣어도 되는거맞ㅈ ㅕ ?..
걍 다 지우고 다시해야할거같은 느낌이 강하게 들긴하네 ㅂㄷ..
윽 안드로이드 극혐
ㄴ 음 영어영.. ㅇ ㅓ 뭔 지 모르겠네여 ㅂㄷ..
음 고칠 곳이 많이 있는데 자바 공부하고 오셔요 쓰레드까지만 공부하면 됨