मैं एंड्रॉयड android.app.Dialog
का उपयोग (बटन और पृष्ठभूमि के लिए) एक कस्टम संवाद बनाने के लिए मेरे संवाद मैं में एक TextView
एक ScrollView
अंदर, जबकि मैं एक छोटे पाठ इस शो perfecly मैं कैसे करना चाहते हैं नहीं है, लेकिन अगर पाठ बहुत बड़ा है मेरा संवाद पूर्ण स्क्रीन लेता है और मैं संवाद और स्क्रीन के किनारे के बीच न्यूनतम मार्जिन चाहता हूं।एंड्रॉयड: संवाद न्यूनतम मार्जिन
मेरी समस्या यह है कि मैं संवाद को बड़ा नहीं करना चाहता हूं और आवश्यकता है कि मैं इस पर एक निश्चित आकार निर्धारित नहीं कर सकता?
Here is how this look today.....I what a margin like this
GameDialog.java
public class GameDialog extends Dialog {
public GameDialog(Context ct, int titleID, int messageID) {
super(ct, R.style.dialog_style);
this.setContentView(R.layout.dialog_layout);
}
// This exist more code but this has noting with the layout to do,only set the text and show the button that exist since the XML file.
}
R.style.dialog_style
<style name="dialog_style" parent="@android:style/Theme.Dialog">
<item name="android:windowBackground">?button_image</item>
<item name="android:windowNoTitle">true</item>
<item name="android:textColor">#FF000000</item>
<item name="android:textSize">20sp</item>
</style>
R.layout.dialog_layout
<?xml version="1.0" encoding="utf-8"?>
<!-- Dialog layout that show title and a textarea, and under this allow a row of button that is center layout. -->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="14px"
android:layout_marginRight="14px">
<TextView
android:layout_gravity="center_vertical"
android:id="@+id/text_title"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</TextView>
</LinearLayout>
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_weight="1"
android:layout_marginLeft="14px"
android:layout_marginRight="14px">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView android:id="@+id/text_main"
android:padding="5px"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
</TextView>
</ScrollView>
</LinearLayout>
<LinearLayout
android:id="@+id/layout_button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<!-- this will be show while need to show a button -->
<ImageView
style="?icon_size.button"
android:visibility="gone"/>
<ImageView
style="?icon_size.button"
android:visibility="gone"/>
<ImageView
style="?icon_size.button"
android:visibility="gone"/>
<ImageView
style="?icon_size.button"
android:visibility="gone"/>
<ImageView
style="?icon_size.button"
android:visibility="gone"/>
</LinearLayout>
</LinearLayout>
क्षमा करें, मैंने आपके पहले जवाब के साथ अपने प्रश्न को गलत समझा। –
कोई समस्या नहीं, क्या आपके पास कुछ अन्य हैं? –
अद्यतन उत्तर। –