मेरे पास xml द्वारा AlertDialog चौड़ाई और ऊंचाई को बदलने का कार्य है, मैं इसे शैली बनना चाहता हूं, इसलिए मैं इसे आसानी से उपयोग कर सकता हूं। और, मुझे अलर्टडिअलॉग शैली के बटन को भी बदलने की ज़रूरत है। क्या आप मुझे एक तरीका बता सकते हैं target.Thank आप बहुत आभारी हासिल करते हैं। पुनश्च, मैं बेहतर परिवर्तन एक्सएमएल द्वारा लक्ष्य को प्राप्त होगा।एंड्रॉइड: मैं अलर्टडियलॉग चौड़ाई और ऊंचाई, और अलर्टडिअलॉग शैली के बटन को कैसे सेट कर सकता हूं?
उत्तर
वहाँ दो तरीकों 1) प्रोग्राम के 2) XML लेआउट
1)=======>
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setView(layout);
builder.setTitle("Title");
alertDialog = builder.create();
alertDialog.show();
alertDialog.getWindow().setLayout(600, 400); //Controlling width and height.
(or)
alertDialog.show();
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
lp.copyFrom(alertDialog.getWindow().getAttributes());
lp.width = 150;
lp.height = 500;
lp.x=-170;
lp.y=100;
alertDialog.getWindow().setAttributes(lp);
यदि आप चाहते हैं का उपयोग करके कर रहे हैं Alert dialog
जैसे प्रदर्शित होने के लिए लेआउट दिखाने के लिए this
2)========>
choose.xml
<TextView
android:id="@+id/img"
android:layout_width="wrap_content"
android:text="@string/choose"
android:textSize="25dp"
android:textColor="#fff"
android:layout_height="50dp"/>
<TableLayout android:id="@+id/table"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#fff"
android:orientation="vertical">
<TableRow
android:id="@+id/tr1"
android:orientation="horizontal"
android:layout_margin="10dp">
<ImageView
android:contentDescription="@string/phone"
android:src="@drawable/phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/phnText"
android:layout_width="wrap_content"
android:text="@string/phone"
android:gravity="left|center_vertical"
android:layout_marginLeft="10dp"
android:textSize="25dp"
android:textColor="#000"
android:layout_height="50dp"/>
</TableRow>
<View
android:layout_width="fill_parent"
android:layout_height="1dip"
android:background="#FF000000" />
<TableRow
android:id="@+id/tr2"
android:orientation="horizontal"
android:layout_margin="10dp">
<ImageView
android:contentDescription="@string/sms"
android:src="@drawable/sms"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/smsText"
android:layout_width="wrap_content"
android:text="@string/sms"
android:gravity="left|center_vertical"
android:layout_marginLeft="10dp"
android:textSize="25dp"
android:textColor="#000"
android:layout_height="50dp"/>
</TableRow>
</TableLayout>
</LinearLayout>
प्रदर्शन इस पॉपअप के रूप में के रूप में की तरह
नीचेprivate void showPopUp()
{
final AlertDialog.Builder helpBuilder = new AlertDialog.Builder(this);
helpBuilder.setTitle("");
LayoutInflater inflater = getLayoutInflater();
final View checkboxLayout = inflater.inflate(R.layout.choose, null);
helpBuilder.setView(checkboxLayout);
final AlertDialog helpDialog = helpBuilder.create();
helpDialog.show();
TableRow tablerowPhone = (TableRow)checkboxLayout.findViewById(R.id.tr1);
TableRow tablerowSms = (TableRow)checkboxLayout.findViewById(R.id.tr2);
tablerowPhone.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
helpDialog.dismiss();
Uri callUri = Uri.parse("tel:" + listview_array[4]);
Intent intent = new Intent(Intent.ACTION_CALL, callUri);
startActivity(intent);
}
});
tablerowSms.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
helpDialog.dismiss();
Uri smsUri = Uri.parse("sms:" + listview_array[4]);
Intent intent = new Intent(Intent.ACTION_VIEW, smsUri);
startActivity(intent);
}
});
}
कॉल इस showPopUp()
विधि जहाँ आप चाहते हैं। ताकि आप xml फ़ाइल में लेआउट
बहुत बहुत धन्यवाद। इस तरह से यह कर सकता है, लेकिन मैं इसे xml फ़ाइल द्वारा करना चाहता हूं। क्योंकि मैं कॉन्फ़िगर करना चाहता हूं xml मेरे आवेदन के लिए। क्या आपके पास xml फ़ाइल द्वारा ऐसा करने का कोई तरीका है? बार-बार धन्यवाद। – oldfox3721
इस प्रयास करें करने के लिए ऊंचाई और चौड़ाई निर्धारित कर सकते हैं, यह मेरे लिए काम करता है,
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setView(layout);
builder.setTitle("Title");
alertDialog = builder.create();
alertDialog.getWindow().setLayout(600, 400); //Controlling width and height.
alertDialog.show();
- 1. एंड्रॉइड में, मैं ListView आइटम की ऊंचाई और चौड़ाई कैसे सेट कर सकता हूं?
- 2. एंड्रॉइड में बटन की चौड़ाई और ऊंचाई को कैसे बदलें
- 3. सेट दृश्य चौड़ाई और ऊंचाई
- 4. बटन की समान चौड़ाई और ऊंचाई कैसे सेट करें
- 5. फैंक्सबॉक्स सेट ऊंचाई और चौड़ाई
- 6. ऊंचाई और चौड़ाई को कैसे हटाएं?
- 7. मैं एडिटटेक्स्ट और बटन की ऊंचाई कैसे बदल सकता हूं?
- 8. एंड्रॉइड अलर्टडियलॉग सेट व्यू नियम
- 9. मैं एक बटन का आकार कैसे सेट कर सकता हूं?
- 10. मैं AlertDialog में सकारात्मक और नकारात्मक बटन का क्रम कैसे सेट कर सकता हूं?
- 11. मैं सीएसएस का उपयोग कर तत्व ऊंचाई और चौड़ाई कैसे स्केल कर सकता हूं?
- 12. UIWebView चौड़ाई और ऊंचाई सेट करना
- 13. मैं रन टाइम पर स्क्रीन ऊंचाई और चौड़ाई की गणना कैसे कर सकता हूं?
- 14. स्क्रीन चौड़ाई और ऊंचाई
- 15. रैप सामग्री के रूप में बटन ऊंचाई और चौड़ाई सेट करें और पैरेंट
- 16. अलर्टडिअलॉग को बंद करने से खोज बटन कैसे रखें?
- 17. एचटीएमएल 'टीडी' चौड़ाई और ऊंचाई
- 18. TinyMCE चौड़ाई और ऊंचाई अवज्ञाकारी!
- 19. UserControl क्रम चौड़ाई और ऊंचाई
- 20. मैं div को अपनी सामग्री की समान चौड़ाई और ऊंचाई कैसे बना सकता हूं?
- 21. जेपीनल की चौड़ाई और ऊंचाई कैसे सेट करें?
- 22. मैं तालिका कॉलम चौड़ाई को कैसे सीमित कर सकता हूं?
- 23. मैं 16px की चौड़ाई और ऊंचाई के साथ एक चेकबॉक्स कैसे बना सकता हूं?
- 24. टूलबार बटन ऊंचाई कैसे सेट करें?
- 25. मैं स्क्रीन ऊंचाई के आधार पर ग्रिड व्यू सेल की ऊंचाई कैसे सेट कर सकता हूं?
- 26. एचटीएमएल 5 - क्या मैं आईएमजी में चौड़ाई और ऊंचाई का उपयोग कर सकता हूं?
- 27. GetSupportedPreviewSize रिवर्स चौड़ाई और ऊंचाई
- 28. एंड्रॉइड - डिफ़ॉल्ट बटन शैली
- 29. डिवाइस कच्ची चौड़ाई और ऊंचाई या वास्तविक स्क्रीन चौड़ाई और ऊंचाई कैसे प्राप्त करें?
- 30. मैं किसी अन्य तत्व के अंदर एक div को 100% ऊंचाई और चौड़ाई कैसे स्केल कर सकता हूं
आप कुछ इस तरह http://stackoverflow.com/questions/1979369/ हो सकता है एंड्रॉइड-एक्टिविटी-ए-ए-डायलॉग –
@ userIsamonkey, बहुत बहुत धन्यवाद, मैंने एक संवाद के रूप में गतिविधि का उपयोग करने के बारे में सोचा है, लेकिन यह संवाद का उपयोग करने के लिए मेरे कार्य के लिए उपयुक्त है। क्योंकि दिखाने के लिए कई संवाद इंतजार हैं। हम चाहते हैं कि एक शैली दिखाना आसान हो। धन्यवाद, अन्यथा। – oldfox3721