Skip to content

Commit

Permalink
change in layout file
Browse files Browse the repository at this point in the history
Add radiobutton and EditText
dimens files add
strings files add All questions
  • Loading branch information
tarsbirsingh committed Apr 26, 2018
1 parent c584520 commit db687a3
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 9 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
26 changes: 21 additions & 5 deletions app/src/main/java/com/example/hp/quiz/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,28 @@

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

@Override
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

final EditText editName = findViewById(R.id.editText_name);
final TextView displayText = findViewById(R.id.textView_name);
Button showButton = findViewById(R.id.button_show);

showButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String name = editName.getText().toString();
displayText.setText(name);

}
});
}
}
23 changes: 19 additions & 4 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:orientation="vertical"
android:background="@color/colorAccent">

<TextView
android:layout_width="match_parent"
Expand All @@ -18,7 +19,7 @@
android:text="@string/qName"
android:textSize="@dimen/font_size_medium" />
<EditText
android:id="@+id/name"
android:id="@+id/editText_name"
android:layout_marginStart="@dimen/oneFour"
android:layout_marginEnd="@dimen/ten"
android:layout_marginTop="@dimen/oneSix"
Expand All @@ -36,10 +37,12 @@
android:textSize="@dimen/font_size_medium"/>
<RadioGroup
android:id="@+id/rg_Q1"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/oneSix"
android:layout_marginStart="@dimen/oneFour">
android:background="@android:color/holo_orange_light"
android:layout_marginStart="@dimen/oneFour"
android:layout_marginEnd="@dimen/oneFour">
<RadioButton
android:id="@+id/rb_Q1_op1"
android:layout_width="wrap_content"
Expand Down Expand Up @@ -70,6 +73,18 @@
</RadioButton>

</RadioGroup>
<TextView
android:id="@+id/textView_name"
android:text="@string/Result"
android:layout_marginTop="@dimen/oneFour"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/button_show"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="130dp"
android:text="@string/Result" />

</LinearLayout>

Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,7 @@
<string name="getResult">Submit</string>
<string name="Answer">Answer</string>
<string name="reset">Reset</string>


<string name="Result">Result</string>
</resources>

0 comments on commit db687a3

Please sign in to comment.