শৈলী সম্পদ
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
একটি শৈলী সম্পদ বিন্যাস সংজ্ঞায়িত করে এবং একটি UI সন্ধান করে। একটি স্টাইল একটি পৃথক View
(একটি লেআউট ফাইলের মধ্যে থেকে) বা একটি সম্পূর্ণ Activity
বা অ্যাপ্লিকেশনে (মেনিফেস্ট ফাইলের মধ্যে থেকে) প্রয়োগ করা যেতে পারে।
শৈলী তৈরি এবং প্রয়োগ সম্পর্কে আরও তথ্যের জন্য, অনুগ্রহ করে স্টাইল এবং থিম পড়ুন।
দ্রষ্টব্য: একটি শৈলী হল একটি সাধারণ সম্পদ যা name
বৈশিষ্ট্যে প্রদত্ত মান ব্যবহার করে উল্লেখ করা হয় (এক্সএমএল ফাইলের নাম নয়)। যেমন, আপনি একটি XML ফাইলে, একটি <resources>
উপাদানের অধীনে অন্যান্য সাধারণ সংস্থানগুলির সাথে শৈলী সংস্থানগুলিকে একত্রিত করতে পারেন।
- ফাইল অবস্থান:
-
res/values/ filename .xml
ফাইলের নাম নির্বিচারে। উপাদানের name
রিসোর্স আইডি হিসাবে ব্যবহার করা হবে। - সম্পদ রেফারেন্স:
- XML-এ:
@[package:]style/ style_name
- সিনট্যাক্স:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style
name="style_name"
parent="@[package:]style/style_to_inherit">
<item
name="[package:]style_property_name"
>style_value</item>
</style>
</resources>
- উপাদান:
-
<resources>
- প্রয়োজন। এটি অবশ্যই রুট নোড হতে হবে।
কোন বৈশিষ্ট্য নেই.
-
<style>
- একটি একক শৈলী সংজ্ঞায়িত করে।
<item>
উপাদান রয়েছে। গুণাবলী:
-
name
- স্ট্রিং প্রয়োজন শৈলীর জন্য একটি নাম, যা একটি ভিউ, অ্যাক্টিভিটি বা অ্যাপ্লিকেশনে শৈলী প্রয়োগ করতে রিসোর্স আইডি হিসাবে ব্যবহৃত হয়।
-
parent
- শৈলী সম্পদ । একটি শৈলীর রেফারেন্স যা থেকে এই শৈলীটি শৈলী বৈশিষ্ট্যের উত্তরাধিকারী হওয়া উচিত।
-
<item>
- শৈলীর জন্য একটি একক সম্পত্তি সংজ্ঞায়িত করে। একটি
<style>
উপাদানের সন্তান হতে হবে। গুণাবলী:
-
name
- অ্যাট্রিবিউট রিসোর্স । প্রয়োজন প্রয়োজনে প্যাকেজ উপসর্গ সহ সংজ্ঞায়িত করা শৈলী সম্পত্তির নাম (উদাহরণস্বরূপ
android:textColor
)।
- উদাহরণ:
- শৈলীর জন্য XML ফাইল (
res/values/
এ সংরক্ষিত): <?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="CustomText" parent="@style/Text">
<item name="android:textSize">20sp</item>
<item name="android:textColor">#008</item>
</style>
</resources>
- XML ফাইল যা একটি
TextView
এ শৈলী প্রয়োগ করে ( res/layout/
এ সংরক্ষিত): <?xml version="1.0" encoding="utf-8"?>
<EditText
style="@style/CustomText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Hello, World!" />
এই পৃষ্ঠার কন্টেন্ট ও কোডের নমুনাগুলি Content License-এ বর্ণিত লাইসেন্সের অধীনস্থ। Java এবং OpenJDK হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-07-29 UTC-তে শেষবার আপডেট করা হয়েছে।
[[["সহজে বোঝা যায়","easyToUnderstand","thumb-up"],["আমার সমস্যার সমাধান হয়েছে","solvedMyProblem","thumb-up"],["অন্যান্য","otherUp","thumb-up"]],[["এতে আমার প্রয়োজনীয় তথ্য নেই","missingTheInformationINeed","thumb-down"],["খুব জটিল / অনেক ধাপ","tooComplicatedTooManySteps","thumb-down"],["পুরনো","outOfDate","thumb-down"],["অনুবাদ সংক্রান্ত সমস্যা","translationIssue","thumb-down"],["নমুনা / কোড সংক্রান্ত সমস্যা","samplesCodeIssue","thumb-down"],["অন্যান্য","otherDown","thumb-down"]],["2025-07-29 UTC-তে শেষবার আপডেট করা হয়েছে।"],[],[],null,["# Style resource\n\nA style resource defines the format and look for a UI.\nA style can be applied to an individual [View](/reference/android/view/View) (from within a layout file) or to\nan entire [Activity](/reference/android/app/Activity) or application (from within the manifest file).\n\nFor more information about creating and applying styles, please read\n[Styles and Themes](/guide/topics/ui/themes).\n\n**Note:** A style is a simple resource that is referenced\nusing the value provided in the `name` attribute (not the name of the XML file). As\nsuch, you can combine style resources with other simple resources in the one XML file,\nunder one `\u003cresources\u003e` element.\n\nfile location:\n: `res/values/`*filename*`.xml` \n\n The filename is arbitrary. The element's `name` will be used as the resource ID.\n\nresource reference:\n:\n In XML: `@[package:]style/`*style_name*\n\nsyntax:\n:\n\n ```xml\n \u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n \u003cresources\u003e\n \u003cstyle\n name=\"style_name\"\n parent=\"@[package:]style/style_to_inherit\"\u003e\n \u003citem\n name=\"[package:]style_property_name\"\n \u003estyle_value\u003c/item\u003e\n \u003c/style\u003e\n \u003c/resources\u003e\n ```\n\nelements:\n:\n\n `\u003cresources\u003e`\n : **Required.** This must be the root node.\n\n No attributes.\n\n `\u003cstyle\u003e`\n : Defines a single style. Contains `\u003citem\u003e` elements.\n\n attributes:\n\n `name`\n : *String* . **Required**. A name for the style, which is used as the\n resource ID to apply the style to a View, Activity, or application.\n\n `parent`\n : *Style resource*. Reference to a style from which this\n style should inherit style properties.\n\n\n `\u003citem\u003e`\n : Defines a single property for the style. Must be a child of a\n `\u003cstyle\u003e` element.\n\n \u003cbr /\u003e\n\n\n attributes:\n\n `name`\n : *Attribute resource* . **Required** . The name of the style property\n to be defined, with a package prefix if necessary (for example `android:textColor`).\n\n\nexample:\n:\n\n XML file for the style (saved in `res/values/`):\n :\n\n ```xml\n \u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n \u003cresources\u003e\n \u003cstyle name=\"CustomText\" parent=\"@style/Text\"\u003e\n \u003citem name=\"android:textSize\"\u003e20sp\u003c/item\u003e\n \u003citem name=\"android:textColor\"\u003e#008\u003c/item\u003e\n \u003c/style\u003e\n \u003c/resources\u003e\n ```\n\n XML file that applies the style to a [TextView](/reference/android/widget/TextView)\n (saved in `res/layout/`):\n :\n\n ```xml\n \u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n \u003cEditText\n style=\"@style/CustomText\"\n android:layout_width=\"fill_parent\"\n android:layout_height=\"wrap_content\"\n android:text=\"Hello, World!\" /\u003e\n ```"]]